MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / siblingCheck

Function siblingCheck

libs/jquery-3.5.1/jquery-3.5.1.js:971–991  ·  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

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

Callers 1

jquery-3.5.1.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected