(
/** @type {HtmlAttribute[]} */ attrs,
/** @type {string} */ name
)
| 4609 | // Linear attribute lookup by name — avoids the per-call arrow `Array#find` |
| 4610 | // would allocate (attribute lists are short, so a plain loop is faster too). |
| 4611 | const findAttr = ( |
| 4612 | /** @type {HtmlAttribute[]} */ attrs, |
| 4613 | /** @type {string} */ name |
| 4614 | ) => { |
| 4615 | for (let i = 0; i < attrs.length; i++) { |
| 4616 | if (attrs[i].name === name) return attrs[i]; |
| 4617 | } |
| 4618 | return undefined; |
| 4619 | }; |
| 4620 | |
| 4621 | /** |
| 4622 | * @param {string} source HTML source |
no outgoing calls
no test coverage detected