Skip to content

Commit

Permalink
Move declaration inside sortOrder as we don't need to do those checks…
Browse files Browse the repository at this point in the history
… until later.
  • Loading branch information
jeresig committed May 10, 2011
1 parent 2f96e52 commit 4817214
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sizzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,13 +921,6 @@ if ( document.documentElement.compareDocumentPosition ) {

} else {
sortOrder = function( a, b ) {
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;

// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
Expand All @@ -936,9 +929,17 @@ if ( document.documentElement.compareDocumentPosition ) {
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}

var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;

// If the nodes are siblings (or identical) we can do a quick check
} else if ( aup === bup ) {
if ( aup === bup ) {
return siblingCheck( a, b );

// If no parents were found then the nodes are disconnected
Expand Down

0 comments on commit 4817214

Please sign in to comment.