Skip to content

Commit

Permalink
Merging from Sizzle (fixed a bug when querySelectorAll is used.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Jan 5, 2009
1 parent 4694e53 commit 558d03f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,21 +684,22 @@ try {
if ( document.querySelectorAll ) (function(){
var oldSizzle = Sizzle;

Sizzle = function(query, context, extra){
Sizzle = function(query, context, extra, seed){
context = context || document;

if ( context.nodeType === 9 ) {
if ( !seed && context.nodeType === 9 ) {
try {
return makeArray( context.querySelectorAll(query) );
} catch(e){}
}

return oldSizzle(query, context, extra);
return oldSizzle(query, context, extra, seed);
};

Sizzle.find = oldSizzle.find;
Sizzle.filter = oldSizzle.filter;
Sizzle.selectors = oldSizzle.selectors;
Sizzle.matches = oldSizzle.matches;
})();

if ( document.documentElement.getElementsByClassName ) {
Expand Down

0 comments on commit 558d03f

Please sign in to comment.