MCPcopy Index your code
hub / github.com/Blogify/Blogify / siblingCheck

Function siblingCheck

public/assets/assets/scripts/frontend.js:923–944  ·  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

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

Callers 1

frontend.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected