You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: make DOM type checks realm-agnostic (ref #494)
`node instanceof HTMLInputElement` is false for a node that belongs to another
window, because every realm owns its constructors. When the parent document
captured a same-origin iframe, I was not recognising the inputs, textareas and
selects inside it, so their typed values, placeholder colour and state
attributes (disabled, required, readonly) were dropped from the clone. The same
checks gated SVG paint materialisation, shadow-root detection, replaced-element
sizing and the resolveNode plugin hook.
I added src/utils/dom.js with predicates based on nodeType and namespaceURI
(isHTMLTag, isHTMLElement, isSVGElement, isSVGRoot, isShadowRoot, isDocument,
isNode) and I now use them instead of instanceof in clone, prepare, burst,
counter, styles, svgDefs and the capture/prepare helpers.
I covered it in __tests__/snapdom.issue494.test.js with a capture root created
in an iframe realm and with the real path where the parent captures the
<iframe>.
0 commit comments