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

Function Sizzle

docs/_static/jquery-3.6.0.js:759–899  ·  view source on GitHub ↗
( selector, context, results, seed )

Source from the content-addressed store, hash-verified

757}
758
759function Sizzle( selector, context, results, seed ) {
760 var m, i, elem, nid, match, groups, newSelector,
761 newContext = context && context.ownerDocument,
762
763 // nodeType defaults to 9, since context defaults to document
764 nodeType = context ? context.nodeType : 9;
765
766 results = results || [];
767
768 // Return early from calls with invalid selector or context
769 if ( typeof selector !== "string" || !selector ||
770 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
771
772 return results;
773 }
774
775 // Try to shortcut find operations (as opposed to filters) in HTML documents
776 if ( !seed ) {
777 setDocument( context );
778 context = context || document;
779
780 if ( documentIsHTML ) {
781
782 // If the selector is sufficiently simple, try using a "get*By*" DOM method
783 // (excepting DocumentFragment context, where the methods don't exist)
784 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
785
786 // ID selector
787 if ( ( m = match[ 1 ] ) ) {
788
789 // Document context
790 if ( nodeType === 9 ) {
791 if ( ( elem = context.getElementById( m ) ) ) {
792
793 // Support: IE, Opera, Webkit
794 // TODO: identify versions
795 // getElementById can match elements by name instead of ID
796 if ( elem.id === m ) {
797 results.push( elem );
798 return results;
799 }
800 } else {
801 return results;
802 }
803
804 // Element context
805 } else {
806
807 // Support: IE, Opera, Webkit
808 // TODO: identify versions
809 // getElementById can match elements by name instead of ID
810 if ( newContext && ( elem = newContext.getElementById( m ) ) &&
811 contains( context, elem ) &&
812 elem.id === m ) {
813
814 results.push( elem );
815 return results;
816 }

Callers 2

jquery-3.6.0.jsFile · 0.85
multipleContextsFunction · 0.85

Calls 3

containsFunction · 0.85
testContextFunction · 0.85
toSelectorFunction · 0.85

Tested by

no test coverage detected