You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug when including @pnotify/core/dist/PNotify.js : Calling new Event(...) fails and it seems it's not safe/recommended to replace it with a polyfill directly...(Some say yes, some say no; MDN does not suggest to do so...)
This API does not exists in IE11 but then it can be safely added as a polyfill as described in the MDN Web Docs, and it works fine.
PS: If I understand correctly your README file, the dist/Pnotify.js can be used in ES5 browsers. And I already include es5 and es6 shims in my projects and Pnotify is working fine so far when combined with the use of CustomEvent API and a polyfill of course.
PS2: Another related issue: Setting the Event.detail property after the event has been created is not suppose to work in strict mode (it is supposed to be a RO property); it should instead be included with the parameters in the call to the contructor.
here:
The text was updated successfully, but these errors were encountered:
jybleau
changed the title
Using "Event" constructor should be replaced by the "CustomEvent" one? (IE11 compatibility)
Using "Event" constructor should be replaced by "CustomEvent" constructor? (IE11 compatibility)
May 11, 2020
Firstly, I can create a PR if you want...
I have a problem with those lines in IE11:
pnotify/packages/core/index.svelte
Line 112 in e63f4c8
pnotify/packages/core/index.svelte
Line 394 in e63f4c8
There is a bug when including
@pnotify/core/dist/PNotify.js
:Calling
new Event(...)
fails and it seems it's not safe/recommended to replace it with a polyfill directly... (Some say yes, some say no; MDN does not suggest to do so...)Instead of trying to transpile (if it would rewrite this code correctly?), I found out we should instead be creating an event using the
new CustomEvent(...)
constructorRef to the API:
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
This API does not exists in IE11 but then it can be safely added as a polyfill as described in the MDN Web Docs, and it works fine.
PS: If I understand correctly your README file, the
dist/Pnotify.js
can be used in ES5 browsers. And I already include es5 and es6 shims in my projects and Pnotify is working fine so far when combined with the use ofCustomEvent
API and a polyfill of course.PS2: Another related issue: Setting the
Event.detail
property after the event has been created is not suppose to work in strict mode (it is supposed to be a RO property); it should instead be included with the parameters in the call to the contructor.here:
pnotify/packages/core/index.svelte
Line 398 in e63f4c8
And here is how I modified the code:
jybleau@f3ef80f
Anyway, what do you think about that?
Thanks
The text was updated successfully, but these errors were encountered: