MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / Sizzle

Function Sizzle

public/localscripts/calculationQuestion/jquery.js:1042–1149  ·  view source on GitHub ↗
( selector, context, results, seed )

Source from the content-addressed store, hash-verified

1040}
1041
1042function Sizzle( selector, context, results, seed ) {
1043 var match, elem, m, nodeType,
1044 // QSA vars
1045 i, groups, old, nid, newContext, newSelector;
1046
1047 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
1048 setDocument( context );
1049 }
1050
1051 context = context || document;
1052 results = results || [];
1053
1054 if ( !selector || typeof selector !== "string" ) {
1055 return results;
1056 }
1057
1058 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
1059 return [];
1060 }
1061
1062 if ( documentIsHTML && !seed ) {
1063
1064 // Shortcuts
1065 if ( (match = rquickExpr.exec( selector )) ) {
1066 // Speed-up: Sizzle("#ID")
1067 if ( (m = match[1]) ) {
1068 if ( nodeType === 9 ) {
1069 elem = context.getElementById( m );
1070 // Check parentNode to catch when Blackberry 4.6 returns
1071 // nodes that are no longer in the document #6963
1072 if ( elem && elem.parentNode ) {
1073 // Handle the case where IE, Opera, and Webkit return items
1074 // by name instead of ID
1075 if ( elem.id === m ) {
1076 results.push( elem );
1077 return results;
1078 }
1079 } else {
1080 return results;
1081 }
1082 } else {
1083 // Context is not a document
1084 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
1085 contains( context, elem ) && elem.id === m ) {
1086 results.push( elem );
1087 return results;
1088 }
1089 }
1090
1091 // Speed-up: Sizzle("TAG")
1092 } else if ( match[2] ) {
1093 push.apply( results, context.getElementsByTagName( selector ) );
1094 return results;
1095
1096 // Speed-up: Sizzle(".CLASS")
1097 } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
1098 push.apply( results, context.getElementsByClassName( m ) );
1099 return results;

Callers 3

d3.min.jsFile · 0.85
jquery.jsFile · 0.85
multipleContextsFunction · 0.85

Calls 3

tokenizeFunction · 0.85
toSelectorFunction · 0.85
selectFunction · 0.85

Tested by

no test coverage detected