diff options
author | John Resig <jeresig@gmail.com> | 2007-08-19 07:28:41 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-08-19 07:28:41 +0000 |
commit | 24db022ba06523f92e94ac5fa791fc4865b55ba7 (patch) | |
tree | 0c3a031775eb07a93f426ad41a98f60073bcf025 /src/jquery | |
parent | 735e2e8197e391c2666766d2b2ba924fe5fb73d8 (diff) | |
download | jquery-24db022ba06523f92e94ac5fa791fc4865b55ba7.tar.gz jquery-24db022ba06523f92e94ac5fa791fc4865b55ba7.zip |
Added a fix for IE returning comment nodes in * queries. I put the logic in $.merge() but added a conditional such that the speed hit only effects IE users. (Bug #1155)
Diffstat (limited to 'src/jquery')
-rw-r--r-- | src/jquery/jquery.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 842052537..98cbf372e 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1725,8 +1725,17 @@ jQuery.extend({ merge: function(first, second) { // We have to loop this way because IE & Opera overwrite the length // expando of getElementsByTagName - for ( var i = 0; second[i]; i++ ) - first.push(second[i]); + + // Also, we need to make sure that the correct elements are being returned + // (IE returns comment nodes in a '*' query) + if ( jQuery.browser.msie ) { + for ( var i = 0; second[i]; i++ ) + if ( second[i].nodeType != 8 ) + first.push(second[i]); + } else + for ( var i = 0; second[i]; i++ ) + first.push(second[i]); + return first; }, |