MCPcopy Index your code
hub / github.com/JsAaron/jQuery / siblingCheck

Function siblingCheck

2.1.1/test/sizzle.js:378–399  ·  view source on GitHub ↗

* Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b

( a, b )

Source from the content-addressed store, hash-verified

376 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
377 */
378function siblingCheck( a, b ) {
379 var cur = b && a,
380 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
381 ( ~b.sourceIndex || MAX_NEGATIVE ) -
382 ( ~a.sourceIndex || MAX_NEGATIVE );
383
384 // Use IE sourceIndex if available on both nodes
385 if ( diff ) {
386 return diff;
387 }
388
389 // Check if b follows a
390 if ( cur ) {
391 while ( (cur = cur.nextSibling) ) {
392 if ( cur === b ) {
393 return -1;
394 }
395 }
396 }
397
398 return a ? 1 : -1;
399}
400
401/**
402 * Returns a function to use in pseudos for input types

Callers 1

sizzle.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected