From b29449709a7b797cdb9721600bb552f8f140e64a Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Thu, 30 Jun 2022 10:30:17 +0200 Subject: [PATCH] Specify default passive for document-level wheel/mousewheel/touchstart/touchmove events Tests: https://github.com/web-platform-tests/wpt/pull/34623 Fixes #365. --- dom.bs | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/dom.bs b/dom.bs index 1d3034eb..0918da59 100644 --- a/dom.bs +++ b/dom.bs @@ -951,7 +951,7 @@ dictionary EventListenerOptions { }; dictionary AddEventListenerOptions : EventListenerOptions { - boolean passive = false; + boolean passive; boolean once = false; AbortSignal signal; }; @@ -971,7 +971,7 @@ when something has occurred.
  • type (a string)
  • callback (null or an {{EventListener}} object)
  • capture (a boolean, initially false) -
  • passive (a boolean, initially false) +
  • passive (null or a boolean, initially null)
  • once (a boolean, initially false)
  • signal (null or an {{AbortSignal}} object)
  • removed (a boolean for bookkeeping purposes, initially false) @@ -1069,16 +1069,18 @@ steps:
    1. Let capture be the result of flattening options. -

    2. Let once and passive be false. +

    3. Let once be false. -

    4. Let |signal| be null. +

    5. Let |passive| and |signal| be null.

    6. If |options| is a dictionary, then:

        -
      1. Set |passive| to |options|["{{AddEventListenerOptions/passive}}"] and |once| to - |options|["{{AddEventListenerOptions/once}}"]. +

      2. Set |once| to |options|["{{AddEventListenerOptions/once}}"]. + +

      3. If |options|["{{AddEventListenerOptions/passive}}"] [=map/exists=], then set |passive| to + |options|["{{AddEventListenerOptions/passive}}"].

      4. If |options|["{{AddEventListenerOptions/signal}}"] [=map/exists=], then set |signal| to |options|["{{AddEventListenerOptions/signal}}"]. @@ -1098,6 +1100,26 @@ constructor steps are to do nothing. if this would be useful for your programs. For now, all author-created {{EventTarget}}s do not participate in a tree structure.

        +

        The default passive value, given an event type |type| and an {{EventTarget}} +|eventTarget|, is determined as follows: + +

          +
        1. +

          Return true if all of the following are true: + +

          + +
        2. Return false. +

        +

        To add an event listener, given an {{EventTarget}} object eventTarget and an event listener listener, run these steps: @@ -1115,6 +1137,9 @@ participate in a tree structure.

      5. If listener's callback is null, then return. +

      6. If listener's passive is null, then set it to the + default passive value given |type| and |eventTarget|. +

      7. If eventTarget's event listener list does not contain an event listener whose type is listener's type, callback is listener's