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

Wrong window object for iframes. #644

Closed
mmariano opened this issue Aug 11, 2014 · 3 comments
Closed

Wrong window object for iframes. #644

mmariano opened this issue Aug 11, 2014 · 3 comments

Comments

@mmariano
Copy link

I am assigning events to an iframe or svg from the parent window and hammerjs is using the parent window object when adding addEventListeners(). If you could instead get the element.ownerDocument and then the window object from the document that would help solve this problem.

@jtangelder
Copy link
Member

What's the browser support of that property? I didn't know of its existence!

@mmariano
Copy link
Author

Here is how I have done it in production for a long time.

var doc = element.ownerDocument;
var win = (doc.defaultView || doc.parentWindow);

That works on iframes and svg 's and supports IE.

@julianxhokaxhiu
Copy link

I think that you have to patch it again, because with that code you cannot use window as element, so probably it's best if you do:

var doc = element.ownerDocument || element;

So if element = window, everything works again. Anyway this is just a suggestion, use the best method you want.

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

3 participants