Details
- `NamedNodeMap` detection — read
element.attributesvia the cachedElement.prototype.attributesgetter (introducegetAttributes = lookupGetter(ElementPrototype, 'attributes')) and verifynodeType === 11-style shape (length is a number, indexed[i]returns objects with.name/.valuestrings). Do not rely oninstanceof NamedNodeMap.
- `Element` detection at
:1296— replacecurrentNode instanceof Elementwith a shape check (getNodeType(currentNode) === NODE_TYPE.element).
The invariant the fix should encode: *once IN_PLACE accepts a foreign-realm node for sanitization, every downstream security decision on that node must be foreign-realm-safe.* The cached prototype getters introduced for the shadow-root hardening already point at the right pattern; the fix is to extend that pattern to every realm-bound check in the sanitization path.