Commit a159a32
committed
lib: implement passive listener preventDefault behavior per spec
Implement Web API spec-compliant behavior
for passive event listeners
where preventDefault() and returnValue setting are ignored during
passive listener execution.
- Add kInPassiveListener symbol to track passive listener state
- Modify preventDefault() to ignore calls during
passive listener execution
- Add returnValue setter that respects passive listener state
- Set/clear passive flag around listener invocation in dispatchEvent
Fixes WPT test cases that were previously failing in
AddEventListenerOptions-passive.any.js and
satisfies expected behaviors:
- preventDefault should be ignored
if-and-only-if the passive option is true
- returnValue should be ignored
if-and-only-if the passive option is true
- passive behavior of one listener should be unaffected
by other listeners
Refs: https://dom.spec.whatwg.org/#dom-event-preventdefault1 parent 2e5c8df commit a159a32
1 file changed
+25
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| |||
266 | 270 | | |
267 | 271 | | |
268 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
269 | 288 | | |
270 | 289 | | |
271 | 290 | | |
| |||
760 | 779 | | |
761 | 780 | | |
762 | 781 | | |
763 | | - | |
764 | 782 | | |
765 | 783 | | |
766 | 784 | | |
| |||
824 | 842 | | |
825 | 843 | | |
826 | 844 | | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
827 | 848 | | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
828 | 852 | | |
829 | 853 | | |
830 | 854 | | |
| |||
0 commit comments