(root: Node)
| 1513 | * @return The created NodeIterator |
| 1514 | */ |
| 1515 | const _createNodeIterator = function (root: Node): NodeIterator { |
| 1516 | /* Read ownerDocument through the cached Node.prototype getter, never the |
| 1517 | direct property. HTMLFormElement has [LegacyOverrideBuiltIns], so a |
| 1518 | clobbering child (<input name="ownerDocument"> or a form-associated |
| 1519 | external input) shadows the prototype getter and makes a direct read |
| 1520 | return that <input>. createNodeIterator.call(<input>, ...) then throws |
| 1521 | "Illegal invocation", and on the IN_PLACE path that throw lands before |
| 1522 | the walk's fail-closed barrier - leaving the caller's live tree, with |
| 1523 | any already-armed handler in it, un-neutralized. The cached getter |
| 1524 | returns the real Document regardless of the clobber. */ |
| 1525 | const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument; |
| 1526 | return createNodeIterator.call( |
| 1527 | doc || root, |
| 1528 | root, |
| 1529 | // eslint-disable-next-line no-bitwise |
| 1530 | NodeFilter.SHOW_ELEMENT | |
| 1531 | NodeFilter.SHOW_COMMENT | |
| 1532 | NodeFilter.SHOW_TEXT | |
| 1533 | NodeFilter.SHOW_PROCESSING_INSTRUCTION | |
| 1534 | NodeFilter.SHOW_CDATA_SECTION, |
| 1535 | null |
| 1536 | ); |
| 1537 | }; |
| 1538 | |
| 1539 | /** |
| 1540 | * Replace template expression syntax (mustache, ERB, template |
no outgoing calls
no test coverage detected