From 031d3f1abe587e8aa488a0994f1fac6ea48f49f6 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 27 Feb 2023 06:24:05 -0800 Subject: [PATCH] Change exception thrown when popover attribute is not present As discussed in https://github.com/web-platform-tests/wpt/pull/38512. Those tests were reverted as part of https://github.com/web-platform-tests/wpt/pull/38392. Co-authored-by: Anne van Kesteren --- source | 109 +++++++++++++++++++++++++-------------------------------- 1 file changed, 47 insertions(+), 62 deletions(-) diff --git a/source b/source index e3886076989..6de62d1e183 100644 --- a/source +++ b/source @@ -81856,17 +81856,8 @@ dictionary DragEventInit : MouseEventInit { element and a boolean throwExceptions:

    -
  1. -

    If the result of running check popover validity given element and - false is false, then:

    - -
      -
    1. Assert: throwExceptions is true.

    2. - -
    3. Throw an "InvalidStateError" - DOMException.

    4. -
    -
  2. +
  3. If the result of running check popover validity given element, + false, and throwExceptions is false, then return.

  4. Assert: element is not in element's node document's top layer.

  5. @@ -81880,15 +81871,8 @@ dictionary DragEventInit : MouseEventInit { return.

  6. -

    If the result of running check popover validity given element and - false is false:

    - -
      -
    1. If throwExceptions is true, then throw an - "InvalidStateError" DOMException.

    2. - -
    3. Otherwise, return.

    4. -
    +

    If the result of running check popover validity given element, false, + and throwExceptions is false, then return.

    Check popover validity is called again because firing the beforetoggle event could have disconnected this element or @@ -81919,14 +81903,8 @@ dictionary DragEventInit : MouseEventInit {

  7. If originalType is not equal to the value of element's popover attribute, or if the result of running check - popover validity given element and false is false:

    - -
      -
    1. If throwExceptions is true, then throw an - "InvalidStateError" DOMException.

    2. - -
    3. Otherwise, return.

    4. -
    + popover validity given element, false, and throwExceptions is + false, then return.

    Check popover validity is called again because running hide all popovers until above could have fired the @@ -82020,17 +81998,8 @@ dictionary DragEventInit : MouseEventInit { boolean fireEvents, and a boolean throwExceptions:

      -
    1. -

      If the result of running check popover validity given element and - true is false:

      - -
        -
      1. If throwExceptions is true, then throw an - "InvalidStateError" DOMException.

      2. - -
      3. Otherwise, return.

      4. -
      -
    2. +
    3. If the result of running check popover validity given element, + true, and throwExceptions is false, then return.

    4. Let document be element's node document.

    5. @@ -82074,15 +82043,8 @@ dictionary DragEventInit : MouseEventInit { attribute initialized to "closed" at element.

    6. -

      If the result of running check popover validity given element and - true is false:

      - -
        -
      1. If throwExceptions is true, then throw an - "InvalidStateError" DOMException.

      2. - -
      3. Otherwise, return.

      4. -
      +

      If the result of running check popover validity given element, + true, and throwExceptions is false, then return.

      Check popover validity is called again because firing the beforetoggle event could have disconnected this element or @@ -82358,27 +82320,50 @@ dictionary DragEventInit : MouseEventInit {

    To check popover validity for an HTML element - element given a boolean expectedToBeShowing, perform the following steps. - They return a boolean.

    + element given a boolean expectedToBeShowing and a boolean + throwExceptions, perform the following steps. They throw an exception or return a + boolean.

      -
    1. If element's popover attribute is in the - no popover state, then return false.

    2. +
    3. +

      If element's popover attribute is in the + no popover state, then:

      -
    4. If element is not connected, then return false.

    5. +
        +
      1. If throwExceptions is true, then throw a + "NotSupportedError" DOMException.

      2. -
      3. If expectedToBeShowing is true and element's popover - visibility state is not showing, then return - false.

      4. +
      5. Return false.

      6. +
      + -
    6. If expectedToBeShowing is false and element's popover - visibility state is not hidden, then return - false.

    7. +
    8. +

      If one of the following conditions is true

      -
    9. If element is a dialog element and has the open attribute, then return false.

    10. +
        +
      • element is not connected

      • + +
      • expectedToBeShowing is true and element's popover visibility + state is not showing

      • + +
      • expectedToBeShowing is false and element's popover + visibility state is not hidden

      • + +
      • element is a dialog element and has an open attribute

      • + +
      • element's fullscreen flag is set

      • +
      + +

      then:

      + +
        +
      1. If throwExceptions is true, then throw a + "InvalidStateError" DOMException.

      2. -
      3. If element's fullscreen flag is set, then return false.

      4. +
      5. Return false.

      6. +
      +
    11. Return true.