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

Function siblingCheck

2.0.3/2.0.3.js:1232–1253  ·  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

1230 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
1231 */
1232 function siblingCheck( a, b ) {
1233 var cur = b && a,
1234 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
1235 ( ~b.sourceIndex || MAX_NEGATIVE ) -
1236 ( ~a.sourceIndex || MAX_NEGATIVE );
1237
1238 // Use IE sourceIndex if available on both nodes
1239 if ( diff ) {
1240 return diff;
1241 }
1242
1243 // Check if b follows a
1244 if ( cur ) {
1245 while ( (cur = cur.nextSibling) ) {
1246 if ( cur === b ) {
1247 return -1;
1248 }
1249 }
1250 }
1251
1252 return a ? 1 : -1;
1253 }
1254
1255 /**
1256 * Returns a function to use in pseudos for input types

Callers 1

2.0.3.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected