Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.match() doesn't work if the HTMLElement comes from a different Realm #8

Open
jyasskin opened this issue Feb 16, 2016 · 1 comment
Open

Comments

@jyasskin
Copy link

If an HTML element comes from a different iframe, its constructor won't equal HTMLElement. It'll equal otherWindow.HTMLElement, and that means the test in overwriteMethod('match') returns false when it ought to let the call to .matches() go through.

I'm not sure there's a sensible way to allow this. Testing .constructor.name will miss subclasses of HTMLElement, but you could just test for whether .matches() is callable.

@nathanboktae
Copy link
Owner

Good points. If you're doing iframe testing, what about also injecting another copy of chai and chai-dom into that frame so the .should chain works? yeah it's more work, but so is the story of using iframes in your same domain (something I've always avoided and it never made much sense to me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants