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

onEvent throws on HTMLElement instances that are not elements #166

Open
matthewp opened this issue Jun 25, 2019 · 3 comments
Open

onEvent throws on HTMLElement instances that are not elements #166

matthewp opened this issue Jun 25, 2019 · 3 comments
Labels

Comments

@matthewp
Copy link
Contributor

matthewp commented Jun 25, 2019

For example:

let el = document.createElement('div');

canReflect.onEvent(el.__proto__, "foo", function(){});

This is because el.__proto__ is not the actual element. I'm looking for a way to detect this.

@matthewp matthewp added the bug label Jun 25, 2019
@matthewp
Copy link
Contributor Author

I think the mechanism the DOM uses here is an internal slot that JavaScript doesn't have access to. So there's likely no way to detect that the addEventListener method can be called. try/catch might be the only option.

@chasenlehara
Copy link
Member

chasenlehara commented Jul 23, 2019

@matthewp Was this fixed/worked-around by canjs/can-observable-mixin#94?

@matthewp
Copy link
Contributor Author

It was worked around, not sure if this issue is still valid or not, but I don't need it any more.

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

No branches or pull requests

2 participants