From a743be19bd3622071c22e9874c92024bc3f5367a Mon Sep 17 00:00:00 2001 From: jaubourg Date: Sun, 6 May 2012 01:27:01 +0200 Subject: Fixes #11402. domManip now also removes the closing part of HTML comments or CDATA surrounding executed scripts. Unit tests added. --- src/manipulation.js | 2 +- test/data/cleanScript.html | 10 ++++++++++ test/unit/ajax.js | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/data/cleanScript.html diff --git a/src/manipulation.js b/src/manipulation.js index cc6acee82..888c9f33c 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -29,7 +29,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*\s*$/g, wrapMap = { option: [ 1, "" ], legend: [ 1, "
", "
" ], diff --git a/test/data/cleanScript.html b/test/data/cleanScript.html new file mode 100644 index 000000000..69288a858 --- /dev/null +++ b/test/data/cleanScript.html @@ -0,0 +1,10 @@ + + diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 8be1947fb..d9c4c33e7 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -2467,6 +2467,14 @@ test( "jQuery.domManip - no side effect because of ajaxSetup or global events (# }); }); +test( "jQuery.domManip - script in comments are properly evaluated (#11402)", function() { + expect( 2 ); + stop(); + jQuery( "#qunit-fixture" ).load( "data/cleanScript.html", function() { + start(); + }); +}); + test("jQuery.ajax - active counter", function() { ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active ); }); -- cgit v1.2.3