Closed patrickhlauke closed 6 years ago
That usually ends up being problematic for extending the method in question further, no?
You mean the feature-detect logic in the explainer? Yeah I wasn't attempting to show a full polyfill here. It would be misleading to suggest that this code is a "polyfill" - it doesn't, for example, change the behavior of preventDefault
.
In contrast, the polyfill we have checked into this repo DOES extend addEventListener
.
Yes, it was the feature detect in the explainer...I thought that was the actual polyfill (hadn't checked the one in the repo). Maybe that section of the explainer needs a bit of prose to say something along the lines of "here's an example of how you can feature detect, using a custom addEventListenerWithOptions
function - but in future, you should be able to do it with addEventListener
once the proposed new syntax/feature lands...see also our polyfill..." or something?
Basically, just want to avoid confusion for devs who skim over the code and think that addEventListenerWithOptions
will be the new syntax somehow...
Not sure if this is elegant or kosher, but...instead of defining a new
addEventListenerWithOptions
function, could/should the polyfill simply rewrite/extend/prollyfilladdEventListener
?