events: add initEvent to Event#46069
Conversation
|
@anonrig Thank you for checking. BTW, I have one question. mdn states that Refs: https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelBubble |
|
I believe it will be a breaking change. We should deprecate them, if it’s not, through documentation. |
|
Thank you for feedback. I'll close this PR soon. |
|
I actually disagree with @anonrig here. If the spec defines initEvent on EventTarget we have to implement it in order to be spec compliant. And indeed we fail the relevant WPT tests. |
|
Browsers definitely have to keep supporting it and I think what MDN states is stretching reality. It's probably easier for web developers if Node.js supports it as well so they don't have to adapt code, but I could see an argument for not implementing it. |
|
@deokjinkim feel free to reopen then :) |
initEvent to EventinitEvent to Event
95c95d5 to
f5974f6
Compare
benjamingr
left a comment
There was a problem hiding this comment.
Would be good to add more tests, thanks
initEvent to EventinitEvent to Event
|
@benjamingr Thank you for review. Added description of |
There was a problem hiding this comment.
I'm still not in favor of adding a deprecated API to Node.js without any request from a user, just for the goal of spec compliance.
I couldn't find a past example of adding a deprecated API to Node.js. It's not a blocker, but I want to ask @nodejs/tsc opinion about this before merging.
With web standards I feel that you either implement the standard or you don't. This isn't an API like EventEmitter where we get to do as we please - with EventTarget I feel strongly that changes to the API need to be reflected by changes to the spec. I can definitely see an argument for amending the WHATWG DOM spec (which project members have done in the past) to make initEvent optional (by adding it to an annex clients may implement or making it an extension e.g.). |
fa88cdb to
7fdc27d
Compare
|
Rebased this PR to fix conflict and squashed to 1 commit. |
We've added |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
|
Landed in 2ff8c50 |
Refs: https://dom.spec.whatwg.org/#dom-event-initevent PR-URL: #46069 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>

Refs: https://dom.spec.whatwg.org/#dom-event-initevent