Interact.js not working with elements in iframes if they was created in parent window
See original GitHub issueActual behavior
I have an iframe inserted into my main site and I need to create elements inside the iframe from the parent context. But interact.js doesn’t work if I create new elements from the parent context and then insert them in the iframe. In a real application I cannot create nodes from an iframe document, because the elements are created by the framework (Riot.js) and I cannot control the creation of components.
Demo: https://jsfiddle.net/kachurun/bugqc5dk/79/
Problem on this line: https://github.com/taye/interact.js/blob/55d5d57c4f1ad2f728109bb839f1ed99a45d8ba1/packages/%40interactjs/utils/is.ts#L29
Because thing
really not instance of _window.Element
, but instance of win.window.Element
.
I’m not sure if I know the correct way to fix this, except to add a check to the parent window, or remove the DOM2 part of the condition.
System configuration
interact.js version: 1.10.3
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top GitHub Comments
interact('.target', { context: iframe.contentDocument })
Docs need updating 🙂
@taye thank you for answer
interact('.target', { context: iframe.contentDocument })
This worked for me.