MCPcopy Index your code
hub / github.com/frank-lam/fullstack-tutorial / siblingCheck

Function siblingCheck

notes/docsify/unpkg/gotop/jquery-2.1.0.js:912–933  ·  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

910 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
911 */
912function siblingCheck( a, b ) {
913 var cur = b && a,
914 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
915 ( ~b.sourceIndex || MAX_NEGATIVE ) -
916 ( ~a.sourceIndex || MAX_NEGATIVE );
917
918 // Use IE sourceIndex if available on both nodes
919 if ( diff ) {
920 return diff;
921 }
922
923 // Check if b follows a
924 if ( cur ) {
925 while ( (cur = cur.nextSibling) ) {
926 if ( cur === b ) {
927 return -1;
928 }
929 }
930 }
931
932 return a ? 1 : -1;
933}
934
935/**
936 * Returns a function to use in pseudos for input types

Callers 1

jquery-2.1.0.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…