-
Notifications
You must be signed in to change notification settings - Fork 139
Safe to change behavior of addEventListener(type, callback, object)? #21
Comments
It should be pointed out Gecko has a fourth argument for trusted events. |
I'm not convinced we can really measure the size of the risk here. Sure we can count how many calls there are like I don't know any better option than just to try. Of course we could try making this particular change now on it's own and see if it has any impact, ahead of doing all the work for the new API. Not sure it's worth it though. Is this really any different from, say, adding a new argument to an existing API? People might be accidentally passing all sorts of things as an extra argument already and now we'll start interpreting it somehow rather than ignoring it. Do we really normally worry about that sort of thing pro-actively? |
I think the more likely scenario is Given that Adding a new argument is almost entirely risk free and we don't worry about those cases, but this is changing the interpretation of an existing argument. If the risk does not seems plausible then just trying it is fine by me, but measuring it now could save a few months if it turns out to be a problem. |
We could just default to false unless any other dictionary members are given. Seems the safest. Unless of course someone is passing in objects now that have a capture member... |
To preserve the behavior of existing code that calls |
I suspect the risk here is pretty low. I suggest that we try to ship the API we like best in blink, and watch for any compat issues. If we find non-trivial issues then we can hold off on shipping and revisit the design. |
Chromium is tracking shipping this here, hopefully this will happen soon. |
Update: we see about 0.03% of page loads in Chrome stable passing an object to addEventListener's 3rd argument. This is higher than we expected but still relatively low (around the level we'd consider removing a feature). The behavior change for this has been in Chrome beta for ~4 weeks without a single report of an issue, and so is about to hit Chrome stable. I'll follow-up once we have a couple weeks of experience with this change in Chrome stable. |
@RByers s/stable/beta/ for the first occurrence? |
Nope, we've had the use counter since Chrome 48 (stable for ~6 weeks) but the behavior change (shipping EventListenerOptions) was in Chrome 49 (soon to be stable, in beta for past 4 weeks). |
Oh, right :) |
https://www.chromestatus.com/metrics/feature/timeline/popularity/967 is live again and it looks like it's actually around 0.01%. And with M49 having been stable for almost two weeks, I think this issue can be closed and answered in the affirmative: it is safe to change this behavior. |
Hah, nice timing - I had just decided this morning that it was time to close this today. I won't be surprised if we discover one or two breaks somewhere, but it's clearly not a substantial compat problem. |
I hope blink folks are ok to change the behavior of 3rd param, if that is decided in that other bug. |
@smaug---- You're just saying you hope #12 is resolved? Or something else? |
Yeah, referring to that bug. It may or may change the 3rd param back to boolean. |
The point of shipping that was to find out if it would be safe or not as fast as possible, to revert and plot a new course if not. |
I now have a new tool for answering compat questions like this (cluster runs on top websites). I checked the Alexa Top 10k for what sites were hitting our UseCounter for this during page load and found 8:
All this is to confirm what we already knew (since this has been shipping in Chrome for awhile) - this change is quite web compatible. |
totalcar has an addEventListener in swiper3.1.2.min.js that they seem to be mop.com is just too slow to load for me to debug. On Wed, Apr 6, 2016 at 10:25 PM, Rick Byers notifications@github.com
|
Yeah I see the totalcar code now - thanks. Looks like someone wrote |
If the third argument is of type
(boolean or EventListenerOptions)
, it seems like this would have to change the behavior of existing calls toaddEventListener(type, callback, {})
or any kind of object as the third argument.This would of course be accidental, but given how many calls to
addEventListener
are out there it doesn't seem necessarily safe to change. If overloading the third argument still seems like the way to go, the size of the problem could be measured in Blink.The text was updated successfully, but these errors were encountered: