webcomponents / polyfills

Web Components Polyfills
BSD 3-Clause "New" or "Revised" License
1.13k stars 166 forks source link

Allow event listener options to be specified with a function in addition to an object or boolean #469

Closed sorvell closed 2 years ago

sorvell commented 2 years ago

Fixes #468 and #471

bicknellr commented 2 years ago

Really odd edge case. I guess the code where you found this must have been intentionally using a function in this way, since the problem is that capture isn't set properly in this case?

justinfagnani commented 2 years ago

@bicknellr fyi

Really odd edge case. I guess the code where you found this must have been intentionally using a function in this way, since the problem is that capture isn't set properly in this case?

Yeah, in lit-html we pass the listener from event bindings as both the listener and options arguments. This lets us very easily support an object with handleEvent and options, or a method with the @eventOptions() decorator - which just sets the options properties on the method.

googlebot commented 2 years ago

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

google-cla[bot] commented 2 years ago

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

bicknellr commented 2 years ago

+1 on splitting the event phase part into a different PR, if possible.