-
Notifications
You must be signed in to change notification settings - Fork 19
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
on-load doesn't work for strict mode callers #15
Comments
Yup, getting bit by this issue myself at the moment.
Compiling it all up with
Points to this line Sure enough, I can get around this by not running |
same here, tried to remove onload events in a choo app and replacing them with on-load module:
but have the same error, tried also following:
|
Seems to be a bug in Babel; I don't know what they're doing and don't have the time to debug. Think it's best to file it with them |
@yoshuawuyts Care to elaborate how it's a bug in Babel? AFAICT, independently of Babel transformations, on-load accesses |
@moszeed How is not using babel making a difference? Are you not declaring your code as being in strict mode, whereas babel does this automatically for you? |
@aknuds1 without babel i get the "access to strict mode caller function is censored" error in Firefox. |
@moszeed So babel is not making any difference for you wrt. this bug? The way I understood your previous comment, the error disappears when you don't use it. If babel does indeed not cause the error for you, it confirms my view that it's unrelated to babel. |
Does anyone have any suggestions for how to solve this bug? Should we simply remove the default option for the |
I'd love to remove the FWIW, you can specify your own identifier (this is what const uniqueIdentifier = 1
onload(element, function load () {
console.log('load')
}, function unload () {
console.log('unload')
}, uniqueIdentifier) The identifier is needed so when an element is updated, we know if it's the same portion of code that generated it, regardless of how the element or function looks (so similar ones dont collide). |
If this lib is about firing events when dom nodes are added/removed, why even listen to attribute mutations in the first place? I read through the code base but I don't understand the purpose of |
If the caller of on-load is in strict mode, a TypeError is caused in on-load/index.js:
Function.caller used to retrieve strict caller
.The text was updated successfully, but these errors were encountered: