MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / siblingCheck

Function siblingCheck

docs/_static/jquery-3.6.0.js:975–995  ·  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

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

Callers 1

jquery-3.6.0.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected