X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fselector.js;h=c35fbb1eb9ae99c14cfc02cd06f670fca2f75c42;hb=ffbedf0262b3eea906f39c0115b818d7456a3994;hp=da2724530eb00a5e4964c70a3beb3ff574dd4781;hpb=7cdddebe047302f51c4fd30823565f3ac1553d60;p=jquery.git diff --git a/src/selector.js b/src/selector.js index da27245..c35fbb1 100644 --- a/src/selector.js +++ b/src/selector.js @@ -96,9 +96,9 @@ jQuery.extend({ if ( typeof t != "string" ) return [ t ]; - // Make sure that the context is a DOM Element - if ( context && !context.nodeType ) - context = null; + // check to make sure context is a DOM element or a document + if ( context && context.nodeType != 1 && context.nodeType != 9) + return [ ]; // Set the correct context (if none is provided) context = context || document;