X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fselector.js;h=de8830aa1da8625afc15412b128b3ac67a96017b;hb=70b9aed422c34047299fe6e8934902fae61f2a3e;hp=fb332465df18eb235a85b7f4920171f2ac1c805b;hpb=e907b8769f473d8b3b271ce91fb0e7a1b3a6d24f;p=jquery.git diff --git a/src/selector.js b/src/selector.js index fb33246..de8830a 100644 --- a/src/selector.js +++ b/src/selector.js @@ -144,6 +144,8 @@ Sizzle.uniqueSort = function(results){ } } } + + return results; }; Sizzle.matches = function(expr, set){ @@ -551,7 +553,7 @@ var Expr = Sizzle.selectors = { } else if ( name === "not" ) { var not = match[3]; - for ( i = 0, l = not.length; i < l; i++ ) { + for ( var i = 0, l = not.length; i < l; i++ ) { if ( not[i] === elem ) { return false; } @@ -703,6 +705,13 @@ var sortOrder; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; if ( ret === 0 ) { hasDuplicate = true; @@ -711,6 +720,13 @@ if ( document.documentElement.compareDocumentPosition ) { }; } else if ( "sourceIndex" in document.documentElement ) { sortOrder = function( a, b ) { + if ( !a.sourceIndex || !b.sourceIndex ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + var ret = a.sourceIndex - b.sourceIndex; if ( ret === 0 ) { hasDuplicate = true; @@ -719,6 +735,13 @@ if ( document.documentElement.compareDocumentPosition ) { }; } else if ( document.createRange ) { sortOrder = function( a, b ) { + if ( !a.ownerDocument || !b.ownerDocument ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); aRange.selectNode(a); aRange.collapse(true); @@ -1036,6 +1059,8 @@ jQuery.sibling = function(n, elem){ return r; }; +jQuery.unique = Sizzle.uniqueSort; + return; window.Sizzle = Sizzle;