MCPcopy Create free account
hub / github.com/TruthHun/BookStack / Sizzle

Function Sizzle

static/wangEditor/js/lib/jquery-2.2.1.js:733–865  ·  view source on GitHub ↗
( selector, context, results, seed )

Source from the content-addressed store, hash-verified

731}
732
733function Sizzle( selector, context, results, seed ) {
734 var m, i, elem, nid, nidselect, match, groups, newSelector,
735 newContext = context && context.ownerDocument,
736
737 // nodeType defaults to 9, since context defaults to document
738 nodeType = context ? context.nodeType : 9;
739
740 results = results || [];
741
742 // Return early from calls with invalid selector or context
743 if ( typeof selector !== "string" || !selector ||
744 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
745
746 return results;
747 }
748
749 // Try to shortcut find operations (as opposed to filters) in HTML documents
750 if ( !seed ) {
751
752 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
753 setDocument( context );
754 }
755 context = context || document;
756
757 if ( documentIsHTML ) {
758
759 // If the selector is sufficiently simple, try using a "get*By*" DOM method
760 // (excepting DocumentFragment context, where the methods don't exist)
761 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
762
763 // ID selector
764 if ( (m = match[1]) ) {
765
766 // Document context
767 if ( nodeType === 9 ) {
768 if ( (elem = context.getElementById( m )) ) {
769
770 // Support: IE, Opera, Webkit
771 // TODO: identify versions
772 // getElementById can match elements by name instead of ID
773 if ( elem.id === m ) {
774 results.push( elem );
775 return results;
776 }
777 } else {
778 return results;
779 }
780
781 // Element context
782 } else {
783
784 // Support: IE, Opera, Webkit
785 // TODO: identify versions
786 // getElementById can match elements by name instead of ID
787 if ( newContext && (elem = newContext.getElementById( m )) &&
788 contains( context, elem ) &&
789 elem.id === m ) {
790

Callers 2

jquery-2.2.1.jsFile · 0.70
multipleContextsFunction · 0.70

Calls 6

getAttributeMethod · 0.80
toSelectorFunction · 0.70
testContextFunction · 0.70
containsFunction · 0.50
tokenizeFunction · 0.50
setAttributeMethod · 0.45

Tested by

no test coverage detected