(/** @type {Token} */ t)
| 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, |
no test coverage detected