(/** @type {StartTagToken} */ t)
| 5975 | }; |
| 5976 | |
| 5977 | const startTagInBody = (/** @type {StartTagToken} */ t) => { |
| 5978 | const name = t.name; |
| 5979 | if (name === "html") { |
| 5980 | if (open.some(isHtmlTemplateEl)) { |
| 5981 | return; |
| 5982 | } |
| 5983 | const htmlEl = open[0]; |
| 5984 | for (const a of t.attrs) { |
| 5985 | if (!htmlEl.attributes.some((x) => x.name === a.name)) { |
| 5986 | htmlEl.attributes.push(a); |
| 5987 | } |
| 5988 | } |
| 5989 | return; |
| 5990 | } |
| 5991 | if (HEAD_ELEMENTS.has(name)) { |
| 5992 | return modes.inHead(t); |
| 5993 | } |
| 5994 | if (name === "body") { |
| 5995 | const second = open[1]; |
| 5996 | if (!second || second.tagName !== "body" || open.some(isHtmlTemplateEl)) { |
| 5997 | return; |
| 5998 | } |
| 5999 | framesetOk = false; |
| 6000 | for (const a of t.attrs) { |
| 6001 | if (!second.attributes.some((x) => x.name === a.name)) { |
| 6002 | second.attributes.push(a); |
| 6003 | } |
| 6004 | } |
| 6005 | return; |
| 6006 | } |
| 6007 | if (name === "frameset") { |
| 6008 | const second = open[1]; |
| 6009 | if (!second || second.tagName !== "body") return; |
| 6010 | if (!framesetOk) return; |
| 6011 | detach(second); |
| 6012 | while (open.length > 1) open.pop(); |
| 6013 | insertHtmlElement("frameset", t.attrs, t.pos); |
| 6014 | mode = MODE_IN_FRAMESET; |
| 6015 | return; |
| 6016 | } |
| 6017 | if (BLOCK_START.has(name)) { |
| 6018 | closeIfPInButtonScope(); |
| 6019 | insertHtmlElement(name, t.attrs, t.pos); |
| 6020 | return; |
| 6021 | } |
| 6022 | if (HEADING.has(name)) { |
| 6023 | closeIfPInButtonScope(); |
| 6024 | if (cur().namespace === NS_HTML && HEADING.has(cur().tagName)) open.pop(); |
| 6025 | insertHtmlElement(name, t.attrs, t.pos); |
| 6026 | return; |
| 6027 | } |
| 6028 | if (name === "pre" || name === "listing") { |
| 6029 | closeIfPInButtonScope(); |
| 6030 | insertHtmlElement(name, t.attrs, t.pos); |
| 6031 | t.swallowNewline = true; |
| 6032 | framesetOk = false; |
| 6033 | return; |
| 6034 | } |
no test coverage detected