(node)
| 54 | let found; |
| 55 | /** @param {import("../lib/html/syntax").HtmlNode} node node to search */ |
| 56 | const walk = (node) => { |
| 57 | if (found || node.type !== NodeType.Element) return; |
| 58 | if (node.tagName === tagName) { |
| 59 | found = node; |
| 60 | return; |
| 61 | } |
| 62 | for (const c of node.children) walk(c); |
| 63 | }; |
| 64 | for (const c of buildHtmlAst(src).children) walk(c); |
| 65 | return /** @type {import("../lib/html/syntax").HtmlElement} */ (found); |
| 66 | }; |