()
| 473 | // special end-tag states) is materialized only when a special mode is |
| 474 | // actually entered — ordinary tags never allocate it. |
| 475 | const contentModeAfterOpenTag = () => { |
| 476 | const m = getContentModeForRange(input, lastOpenTagStart, lastOpenTagEnd); |
| 477 | // Ordinary tags stay in data state regardless of `isForeign` (which only |
| 478 | // vetoes a switch *into* a special mode), so skip the per-open-tag |
| 479 | // `isForeign` callback for them. |
| 480 | if (m === STATE_DATA) return STATE_DATA; |
| 481 | if (callbacks.isForeign !== undefined && callbacks.isForeign()) { |
| 482 | return STATE_DATA; |
| 483 | } |
| 484 | lastOpenTagName = input |
| 485 | .slice(lastOpenTagStart, lastOpenTagEnd) |
| 486 | .toLowerCase(); |
| 487 | return m; |
| 488 | }; |
| 489 | |
| 490 | // HTML fragment parsing: seed the tokenizer with the context element's |
| 491 | // content mode (e.g. a `textarea`/`style`/`script` context starts in |
no test coverage detected