Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

IE Object doesn't support property or method 'contains' #320

Closed
bencroskery opened this issue Nov 1, 2016 · 2 comments
Closed

IE Object doesn't support property or method 'contains' #320

bencroskery opened this issue Nov 1, 2016 · 2 comments
Milestone

Comments

@bencroskery
Copy link

IE 9/10 get an Object doesn't support property or method 'contains' error on Line 463, here's the source. An easy fix is to use the already implemented contains function, although I don't know what the appropriate fix is.

The error is reproducible on any of the samples.

@bethge
Copy link
Contributor

bethge commented Nov 7, 2016

Thank you for the bug report! I believe IE 9 is not supported by PEP, but IE 10 certainly is.

It seems like we have run into this IE bug: Only nodes of type Element support .contains().

Iiuc, on the last iteration of the event propagating up the DOM, we run !target.contains(event.relatedTarget) with target === document. Yet document is not an instance of Element.

Rotating the two conditions of the while loop might already do the job for this case.

I am uncertain if there can be other non-Element nodes when traversing the DOM. Afaik Text nodes can only be leaves, so they would not be traversed when going up/down the DOM.
Yet can they still be the first target of a pointer event? They are an instance of the EventTarget interface.

@slavapvf
Copy link

slavapvf commented Jul 19, 2017

have this issue with svg image on a page. the image is svgimagedocument and classList is undefined

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

No branches or pull requests

4 participants