diff options
author | Ariel Flesler <aflesler@gmail.com> | 2008-12-25 19:47:56 +0000 |
---|---|---|
committer | Ariel Flesler <aflesler@gmail.com> | 2008-12-25 19:47:56 +0000 |
commit | 0e3e470edc77cde0eede8aa6b7642c336d081d66 (patch) | |
tree | ad8519b4ba890c51a3b363a5845e225e85a71786 /src/core.js | |
parent | 4b25b147ab60a026ba1841b313d713fe57530b04 (diff) | |
download | jquery-0e3e470edc77cde0eede8aa6b7642c336d081d66.tar.gz jquery-0e3e470edc77cde0eede8aa6b7642c336d081d66.zip |
jquery core: Closes #3255. The div used in jQuery.clean is emptied in the end. Cleaning the parentNode's properties of the elements.
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core.js b/src/core.js index b35abade3..0e02436fc 100644 --- a/src/core.js +++ b/src/core.js @@ -909,13 +909,14 @@ jQuery.extend({ }, clean: function( elems, context, fragment ) { - var ret = [], scripts = []; context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' if ( typeof context.createElement === "undefined" ) context = context.ownerDocument || context[0] && context[0].ownerDocument || document; + var ret = [], scripts = [], div = context.createElement("div"); + jQuery.each(elems, function(i, elem){ if ( typeof elem === "number" ) elem += ''; @@ -933,7 +934,7 @@ jQuery.extend({ }); // Trim whitespace, otherwise indexOf won't work as expected - var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); + var tags = jQuery.trim( elem ).toLowerCase(); var wrap = // option or optgroup @@ -1009,6 +1010,9 @@ jQuery.extend({ ret = jQuery.merge( ret, elem ); }); + + // Clean up + div.innerHTML = ""; if ( fragment ) { for ( var i = 0; ret[i]; i++ ) { |