MCPcopy Create free account
hub / github.com/Azure/static-web-apps-cli / Sizzle

Function Sizzle

e2e/samples/app/slate/source/javascripts/lib/_jquery.js:730–856  ·  view source on GitHub ↗
(selector, context, results, seed)

Source from the content-addressed store, hash-verified

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

Callers 2

_jquery.jsFile · 0.85
multipleContextsFunction · 0.85

Calls 3

testContextFunction · 0.85
toSelectorFunction · 0.85
execMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…