MCPcopy
hub / github.com/webpack/webpack / process

Function process

lib/html/syntax.js:5166–5186  ·  lib/html/syntax.js::process
(/** @type {Token} */ t)

Source from the content-addressed store, hash-verified

5164 };
5165
5166 const process = (/** @type {Token} */ t) => {
5167 class="cm">// Track the current token's end so explicit closes can set element `.end`.
5168 class="cm">// Dispatch on `type` instead of the `in` operator, which goes megamorphic
5169 class="cm">// across the token union and shows up on the per-token hot path.
5170 const ty = t.type;
5171 if (ty === TOKEN_START_TAG || ty === TOKEN_END_TAG) tokenEnd = t.pos.end;
5172 else if (ty !== TOKEN_EOF) tokenEnd = t.end;
5173 class="cm">// foreign content dispatch
5174 const ac = adjustedCurrent();
5175 const useForeign =
5176 open.length > 0 &&
5177 ac &&
5178 ac.namespace !== NS_HTML &&
5179 ty !== TOKEN_EOF &&
5180 shouldUseForeignRules(ac, t);
5181 if (useForeign) {
5182 foreignContent(t);
5183 return;
5184 }
5185 runMode(t);
5186 };
5187
5188 const shouldUseForeignRules = (
5189 /** @type {HtmlElement} */ ac,

Callers 6

buildHtmlAstFunction · 0.70
endTagInBodyFunction · 0.70
dispatchFunction · 0.70
createSnapshotMethod · 0.50
writeMethod · 0.50
serializeMethod · 0.50

Calls 4

adjustedCurrentFunction · 0.85
shouldUseForeignRulesFunction · 0.85
foreignContentFunction · 0.85
runModeFunction · 0.85

Tested by

no test coverage detected