Skip to content

Commit

Permalink
Follow-up fix for Firefox 2 + 3, Opera 9.6, Safari 3.1 + 3.2 for #7452.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Jan 24, 2011
1 parent 63c0cf5 commit 8a445e8
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions sizzle.js
Expand Up @@ -221,7 +221,21 @@ Sizzle.find = function( expr, context, isXML ) {
}

if ( !set ) {
set = context.getElementsByTagName( "*" );
if ( typeof context.getElementsByTagName !== "undefined" ) {
set = context.getElementsByTagName( "*" );

// Handle Document Fragments that don't have gEBTN
} else {
set = [];

// Should probably recurse through the whole fragment
var cur = context.firstChild;

while ( cur ) {
set.push( cur );
cur = cur.nextSibling;
}
}
}

return { set: set, expr: expr };
Expand Down Expand Up @@ -464,7 +478,9 @@ var Expr = Sizzle.selectors = {
},

TAG: function( match, context ) {
return context.getElementsByTagName( match[1] );
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
Expand Down

0 comments on commit 8a445e8

Please sign in to comment.