Blink: Bindings should automatically generate on<x> attribute version of event listener |
||||
Issue descriptionSee Issue 688183 where we had to go through a whole intent-to-ship process for adding these attributes which were previously missing. Perhaps we should automatically generate the on<x> attribute version for any <x> events that can be attached with window.addEventListener? Perhaps controversial because web specs themselves must explicitly specify both the event listener and the attribute versions. But apparently [source?] Firefox automatically generates both versions, and it's not clear whether there is any value in allowing Blink to provide one without the other.
,
Jun 16 2017
True, I guess it would be bad to generate those if they aren't explicitly listed in some IDL somewhere. Feel free to WontFix, this was just a suggestion. We could also have some kind of warning that says "you have an event type that doesn't have a corresponding on<x> attribute". This came up because ... I'm having trouble finding a source, but someone at Mozilla said we shouldn't have had this bug in the first place, if Chrome worked like Firefox because apparently Firefox generates these automatically.
,
Jun 19 2017
mgiuca@, do you know how FF generates them automatically? Do they have an additional input? For example, if we had the following input file, we could auto-generate them.
# EventType, has onxxx on [Global]?
<x>Event, true
<y>Event, false
...
Or do they use an extended attribute to annotate it? I guess that they should have something as an extra input...
,
Jun 19 2017
,
Jun 20 2017
#3 I've looked everywhere I can for a citation on that but it must've been mentioned to me in person (during the discussions we had around beforeinstallprompt). I'm not familiar with the Firefox codebase and it's possible I misunderstood. We can close this as a WontFix if you like.
,
Jun 20 2017
Thanks for checking things. I close this issue. Feel free to reopen as necessary. |
||||
►
Sign in to add a comment |
||||
Comment 1 by yukishiino@chromium.org
, Jun 15 2017How can we know that |window| should have on<x> attribute without a declaration in the IDL? Suppose that there is: interface <x>Event : Event { ... }; How can we know that |window| should have on<x>? I thought that not all events have their own corresponding on<x> on |window|. Especially for window.onappinstalled, I don't see AppInstalledEvent defined in an IDL. https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/app_banner/WindowInstallation.idl?q=appinstalled+file:%5C.idl$&sq=package:chromium&l=10 Could you elaborate your idea a little bit more (and optionally how feasible is it)? In general, some interfaces derived from EventTarget may have on<x> and some other wouldn't. So it's not trivial whether on<x> should be defined or not. FYI, the spec defines GlobalEventHandlers interface and uses "implements GlobalEventHandlers" as necessary. https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/GlobalEventHandlers.idl