MCPcopy
hub / github.com/hokein/electron-sample-apps / siblingCheck

Function siblingCheck

camera/jquery.js:916–937  ·  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

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

Callers 3

jquery.jsFile · 0.85
jquery-1.7.2.jsFile · 0.85
jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected