MCPcopy
hub / github.com/apache/caldera / siblingCheck

Function siblingCheck

static/jquery/jquery.js:976–997  ·  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

974 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
975 */
976function siblingCheck( a, b ) {
977 var cur = b && a,
978 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
979 ( ~b.sourceIndex || MAX_NEGATIVE ) -
980 ( ~a.sourceIndex || MAX_NEGATIVE );
981
982 // Use IE sourceIndex if available on both nodes
983 if ( diff ) {
984 return diff;
985 }
986
987 // Check if b follows a
988 if ( cur ) {
989 while ( (cur = cur.nextSibling) ) {
990 if ( cur === b ) {
991 return -1;
992 }
993 }
994 }
995
996 return a ? 1 : -1;
997}
998
999/**
1000 * Returns a function to use in pseudos for input types

Callers 1

jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected