diff --git a/source b/source index cd0d47cc723..95d06347d11 100644 --- a/source +++ b/source @@ -2334,10 +2334,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute indices, is empty, item, - iterate, and + iterate, clone sort in ascending order - sort in descending order + sort in descending order + slice (and its + from and + to arguments), and + reverse
  • The stack data structure and the associated definitions for push and pop
  • @@ -56307,10 +56311,12 @@ interface HTMLButtonElement : HTMLElement { data-x="attr-button-command-hide-popover-state">Hide Popover state:

      -
    1. If the result of running check popover validity given - target, true, false, and null is true, then run the - hide popover algorithm given target, true, true, false, and - element.

    2. +
    3. Let validity be the result of running check popover validity + given target, true, and null. If this throws an exception, catch it, and let + validity be false.

    4. + +
    5. If validity is true, then run the hide popover algorithm given + target, true, true, false, and element.

    @@ -56319,15 +56325,25 @@ interface HTMLButtonElement : HTMLElement { data-x="attr-button-command-toggle-popover-state">Toggle Popover state:

      -
    1. If the result of running check popover validity given - target, false, false, and null is true, then run the - show popover algorithm given target, false, and - element.

    2. +
    3. Let validity be the result of running check popover validity + given target, false, and null. If this throws an exception, catch it, and let + validity be false.

    4. + +
    5. If validity is true, then run the show popover + algorithm given target, false, and element.

    6. + +
    7. +

      Otherwise:

      + +
        +
      1. Let validity be the result of running check popover validity + given target, true, and null. If this throws an exception, catch it, and let + validity be false.

      2. -
      3. Otherwise, if the result of running check popover validity given - target, true, false, and null is true, then run the - hide popover algorithm given target, true, - true, false, and element.

      4. +
      5. If validity is true, then run the hide popover algorithm + given target, true, true, false, and element.

      6. +
      +
    @@ -56336,10 +56352,12 @@ interface HTMLButtonElement : HTMLElement { data-x="attr-button-command-show-popover-state">Show Popover state:

      -
    1. If the result of running check popover validity given target, - false, false, and null is true, then run the show popover algorithm given target, false, and - element.

    2. +
    3. Let validity be the result of running check popover validity + given target, false, and null. If this throws an exception, catch it, and let + validity be false.

    4. + +
    5. If validity is true, then run the show popover + algorithm given target, false, and element.

    @@ -65771,18 +65789,10 @@ interface HTMLDialogElement : HTMLElement {
  • Let document be this's node document.

  • Let hideUntil be the result of running topmost popover ancestor - given this, document's showing hint popover list, null, and - false.

  • - -
  • If hideUntil is null, then set hideUntil to the result of running - topmost popover ancestor given this, document's - showing auto popover list, null, and false.

  • - -
  • If hideUntil is null, then set hideUntil to - document.

  • + given this, null, and false.

    -
  • Run hide all popovers until given - hideUntil, false, and true.

  • +
  • Run hide popovers until given document, hideUntil, + false, and true.

  • Run the dialog focusing steps given this.

  • @@ -66038,18 +66048,10 @@ interface HTMLDialogElement : HTMLElement {
  • Let document be subject's node document.

  • Let hideUntil be the result of running topmost popover ancestor - given subject, document's showing hint popover list, null, and - false.

  • - -
  • If hideUntil is null, then set hideUntil to the result of running - topmost popover ancestor given subject, document's - showing auto popover list, null, and false.

  • - -
  • If hideUntil is null, then set hideUntil to - document.

  • + given subject, null, and false.

    -
  • Run hide all popovers until given - hideUntil, false, and true.

  • +
  • Run hide popovers until given document, hideUntil, + false, and true.

  • Run the dialog focusing steps given subject.

  • @@ -91175,8 +91177,8 @@ dictionary DragEventInit : MouseEventInit {

    Every HTML element has a popover trigger, which is an HTML element or null, initially set to null.

    -

    Every HTML element has a popover showing or - hiding, which is a boolean, initially set to false.

    +

    Every HTML element has a popover hiding, which + is a boolean, initially set to false.

    Every HTML element popover toggle task tracker, which is a toggle task tracker or null, initially null.

    @@ -91185,7 +91187,14 @@ dictionary DragEventInit : MouseEventInit { which is a close watcher or null, initially null.

    Every HTML element has an opened in popover - mode, which is a string or null, initially null.

    + mode, which is "auto", "hint", or null, + initially null.

    + +

    Every Document has a hiding popover nesting count, which is a number, + initially 0.

    + +

    Every Document has a showing popover, which is a boolean, initially + false.

    The following attribute change @@ -91249,29 +91258,40 @@ dictionary DragEventInit : MouseEventInit { element or null source:

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

    2. -
    3. Let document be element's node document.

    4. -
    5. Assert: element's popover trigger is null.

    6. +
    7. +

      If document's showing popover is true, or document's + hiding popover nesting count is not 0, then:

      -
    8. Assert: element is not in document's top - layer.

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

      2. + +
      3. Return.

      4. +
      + +

      This prevents showing a popover during the show or hide of another popover.

      + + +
    10. Set document's showing popover to true.

    11. -
    12. Let nestedShow be element's popover showing or - hiding.

    13. +
    14. Let validityResult be the result of running check popover validity + given element, false, and null. If this throws an exception, catch it, and let + validityResult be false.

    15. -
    16. Let fireEvents be the boolean negation of nestedShow.

    17. +
    18. If validityResult is false, then return.

    19. -
    20. Set element's popover showing or hiding to true.

    21. +
    22. Assert: element's popover trigger is null.

    23. + +
    24. Assert: element is not in document's top + layer.

    25. -

      Let cleanupShowingFlag be the following steps:

      +

      Let cleanupShowingSteps be the following steps:

        -
      1. If nestedShow is false, then set element's popover showing - or hiding to false.

      2. +
      3. Set document's showing popover to false.

    26. @@ -91282,107 +91302,87 @@ dictionary DragEventInit : MouseEventInit { data-x="">closed", the newState attribute initialized to "open", and the source attribute initialized to source at - element is false, then run cleanupShowingFlag and return.

      + element is false, then run cleanupShowingSteps and return.

    27. -

      If the result of running check popover validity given element, false, - throwExceptions, and document is false, then run - cleanupShowingFlag and return.

      +

      Set validityResult to the result of running check popover validity + given element, false, and document. If this throws an exception, catch it, + and set validityResult to that exception.

      Check popover validity is called again because firing the beforetoggle event could have disconnected this element or changed its popover attribute.

    28. -
    29. Let shouldRestoreFocus be false.

    30. - -
    31. Let originalType be the current state of element's popover attribute.

    32. - -
    33. Let stackToAppendTo be null.

    34. - -
    35. Let autoAncestor be the result of running the topmost popover - ancestor algorithm given element, document's showing auto - popover list, source, and true.

    36. - -
    37. Let hintAncestor be the result of running the topmost popover - ancestor algorithm given element, document's showing hint - popover list, source, and true.

    38. -
    39. -

      If originalType is the Auto state, - then:

      +

      If validityResult is not true:

        -
      1. Run close entire popover list given document's showing - hint popover list, shouldRestoreFocus, and fireEvents.

      2. - -
      3. Let ancestor be the result of running the topmost popover - ancestor algorithm given element, document's showing auto - popover list, source, and true.

      4. - -
      5. If ancestor is null, then set ancestor to - document.

      6. +
      7. Run cleanupShowingSteps.

      8. -
      9. Run hide all popovers until given - ancestor, shouldRestoreFocus, and fireEvents.

      10. +
      11. If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.

      12. -
      13. Set stackToAppendTo to "auto".

      14. +
      15. Otherwise, return.

    40. -
    41. -

      If originalType is the Hint state, - then:

      +
    42. Let shouldRestoreFocus be false.

    43. -
        -
      1. -

        If hintAncestor is not null, then:

        +
      2. Let originalType be the current state of element's popover attribute.

      3. -
          -
        1. Run hide all popovers until given - hintAncestor, shouldRestoreFocus, and fireEvents.

        2. +
        3. Let ancestor be the result of running the topmost popover ancestor + algorithm given element, source, and true.

        4. -
        5. Set stackToAppendTo to "hint".

        6. -
        - +
      4. Let effectiveType be originalType.

      5. -
      6. -

        Otherwise:

        +
      7. +

        If all of the following are true:

        -
          -
        1. Run close entire popover list given document's showing - hint popover list, shouldRestoreFocus, and fireEvents.

        2. +
            +
          • ancestor is not null;

          • -
          • -

            If autoAncestor is not null, then:

            +
          • ancestor's opened in popover mode is "hint"; and

          • -
              -
            1. Run hide all popovers until given - autoAncestor, shouldRestoreFocus, and fireEvents.

            2. +
            3. effectiveType is the Auto + state,

            4. +
          -
        3. Set stackToAppendTo to "auto".

        4. -
        -
      8. +

        then set effectiveType to the Hint + state.

        -
      9. Otherwise, set stackToAppendTo to "hint".

      10. -
      - -
    +

    Hint popovers are lower priority + than Auto popovers, so an Auto popover cannot have a Hint popover as a 'parent'. To resolve this case, the + effectiveType is 'downgraded' to Hint.

    +
  • If effectiveType is the Auto or + Hint state, then run hide popover stack + until given document, ancestor, Hint, shouldRestoreFocus, and true.

  • + +
  • If effectiveType is the Auto + state, then run hide popover stack until given document, + ancestor, Auto, + shouldRestoreFocus, and true.

  • +
  • -

    If originalType is Auto or If effectiveType is Auto or Hint, then:

      -
    1. Assert: stackToAppendTo is not null.

    2. -
    3. If originalType is not equal to the value of element's popover attribute, then:

        +
      1. Run cleanupShowingSteps.

      2. +
      3. If throwExceptions is true, then throw an "InvalidStateError" DOMException.

      4. @@ -91391,28 +91391,40 @@ dictionary DragEventInit : MouseEventInit {
      5. -

        If the result of running check popover validity given element, - false, throwExceptions, and document is false, then run - cleanupShowingFlag and return.

        +

        Set validityResult to the result of running check popover validity + given element, false, and document. If this throws an exception, catch + it, and set validityResult to that exception.

        -

        Check popover validity is called again because running hide all popovers until above could have fired the - beforetoggle event, and an event handler could have +

        Check popover validity is called again because running hide + popover stack until above could have fired the beforetoggle event, and an event handler could have disconnected this element or changed its popover attribute.

      6. -

        If the result of running topmost auto or hint - popover on document is null, then set shouldRestoreFocus to - true.

        +

        If validityResult is not true:

        + +
          +
        1. Run cleanupShowingSteps.

        2. + +
        3. If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.

        4. + +
        5. Otherwise, return.

        6. +
        +
      7. + +
      8. +

        If the result of running topmost auto or hint popover on document + is null, then set shouldRestoreFocus to true.

        This ensures that focus is returned to the previously-focused element only for the first popover in a stack.

      9. -

        If stackToAppendTo is "auto":

        +

        If effectiveType is Auto:

        1. Assert: document's showing auto popover list does @@ -91425,8 +91437,8 @@ dictionary DragEventInit : MouseEventInit {

          Otherwise:

            -
          1. Assert: stackToAppendTo is "hint".

          2. +
          3. Assert: effectiveType is Hint.

          4. Assert: document's showing hint popover list does not contain element.

          5. @@ -91463,6 +91475,10 @@ dictionary DragEventInit : MouseEventInit {
          6. Add an element to the top layer given element.

          7. +
          8. If effectiveType is Hint and + ancestor's opened in popover mode is "auto", then + set document's hint stack parent to ancestor.

          9. +
          10. Set element's popover visibility state to showing.

          11. @@ -91478,10 +91494,10 @@ dictionary DragEventInit : MouseEventInit { data-x="attr-popover-none-state">No Popover state, then set element's previously focused element to originallyFocusedElement.

            +
          12. Run cleanupShowingSteps.

          13. +
          14. Queue a popover toggle event task given element, "closed", "open", and source.

          15. - -
          16. Run cleanupShowingFlag.

  • @@ -91546,24 +91562,37 @@ dictionary DragEventInit : MouseEventInit { elements">HTML element or null source:

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

    2. +
    3. Let validityResult be the result of running check popover validity + given element, true, and null. If this throws an exception, catch it, and let + validityResult be that exception.

    4. + +
    5. +

      If validityResult is not true:

      + +
        +
      1. If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.

      2. + +
      3. Otherwise, return.

      4. +
      +
    6. Let document be element's node document.

    7. -
    8. Let nestedHide be element's popover showing or - hiding.

    9. +
    10. Let nestedHide be element's popover hiding.

    11. -
    12. Set element's popover showing or hiding to true.

    13. +
    14. Set element's popover hiding to true.

    15. If nestedHide is true, then set fireEvents to false.

    16. +
    17. Increment document's hiding popover nesting count.

    18. +
    19. Let cleanupSteps be the following steps:

        -
      1. If nestedHide is false, then set element's popover showing - or hiding to false.

      2. +
      3. If nestedHide is false, then set element's popover + hiding to false.

      4. If element's popover close watcher is not null, then:

        @@ -91575,33 +91604,69 @@ dictionary DragEventInit : MouseEventInit {
      5. Set element's popover close watcher to null.

    20. + +
    21. Decrement document's hiding popover nesting count.

    +
  • Let autoPopoverListContainsElement be true if document's + showing auto popover list contains + element; otherwise false.

  • + +
  • Let hintPopoverListContainsElement be true if document's + showing hint popover list contains + element; otherwise false.

  • +
  • If element's opened in popover mode is "auto" or "hint", then:

      -
    1. Run hide all popovers until given - element, focusPreviousElement, and fireEvents.

    2. +
    3. If hintPopoverListContainsElement is true, then hide popover stack + until given document, element, Hint, focusPreviousElement, and + fireEvents.

    4. -

      If the result of running check popover validity given element, - true, throwExceptions, and null is false, then run cleanupSteps and - return.

      +

      If element is document's hint stack parent, then + hide popover stack until given document, null, Hint, focusPreviousElement, and + fireEvents.

      -

      Check popover validity is called again because running hide all popovers until could have disconnected - element or changed its popover attribute.

      +

      If the document's hint stack parent is to hide, then + all hint popovers are hidden.

      +
    5. + +
    6. If autoPopoverListContainsElement is true, then hide popover stack + until given document, element, Auto, focusPreviousElement, and + fireEvents.

    7. + +
    8. +

      Set validityResult to the result of running check popover validity + given element, true, and null. If this throws an exception, catch it, and set + validityResult to that exception.

      + +

      Check popover validity is called again because running hide + popover stack until could have disconnected element or changed its popover attribute.

      +
    9. + +
    10. +

      If validityResult is not true:

      + +
        +
      1. Run cleanupSteps.

      2. + +
      3. If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.

      4. + +
      5. Otherwise, return.

      6. +
  • -
  • Let autoPopoverListContainsElement be true if document's - showing auto popover list's last item is element, otherwise - false.

  • -
  • If fireEvents is true:

    @@ -91614,21 +91679,29 @@ dictionary DragEventInit : MouseEventInit { data-x="dom-ToggleEvent-source">source attribute set to source at element.

  • -
  • If autoPopoverListContainsElement is true and document's - showing auto popover list's last item is not element, then run hide all popovers until given element, - focusPreviousElement, and false.

  • -
  • -

    If the result of running check popover validity given element, - true, throwExceptions, and null is false, then run cleanupSteps and - return.

    +

    Set validityResult to the result of running check popover validity + given element, true, and null. If this throws an exception, catch it, and set + validityResult to that exception.

    Check popover validity is called again because firing the beforetoggle event could have disconnected element or changed its popover attribute.

  • +
  • +

    If validityResult is not true:

    + +
      +
    1. Run cleanupSteps.

    2. + +
    3. If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.

    4. + +
    5. Otherwise, return.

    6. +
    +
  • +
  • Request an element to be removed from the top layer given element.

  • @@ -91646,6 +91719,11 @@ dictionary DragEventInit : MouseEventInit {
  • Set element's popover visibility state to hidden.

  • +
  • If element is document's hint stack parent, or + document's showing hint popover list is empty, then set document's hint stack parent to + null.

  • +
  • If fireEvents is true, then queue a popover toggle event task given element, "open", "closed", and source.

  • @@ -91705,8 +91783,8 @@ dictionary DragEventInit : MouseEventInit { visibility state is showing; otherwise false.

    -
  • Run check popover validity given expectedToBeShowing, true, and - null.

  • +
  • Run check popover validity given this, + expectedToBeShowing, and null.

  • @@ -91716,158 +91794,118 @@ dictionary DragEventInit : MouseEventInit {
    -

    To hide all popovers until, given an HTML element or Document endpoint, a boolean +

    To hide popovers until, given a Document document, an HTML element or null endpoint, a boolean focusPreviousElement, and a boolean fireEvents:

      -
    1. If endpoint is an HTML element and - endpoint is not in the popover showing - state, then return.

    2. - -
    3. Let document be endpoint's node document.

    4. - -
    5. Assert: endpoint is a Document or - endpoint's popover visibility state is showing.

    6. - -
    7. Assert: endpoint is a Document or - endpoint's popover attribute is in the Auto state or endpoint's popover attribute is in the Hint state.

    8. - -
    9. -

      If endpoint is a Document:

      - -
        -
      1. Run close entire popover list given document's showing - hint popover list, focusPreviousElement, and fireEvents.

      2. - -
      3. Run close entire popover list given document's showing - auto popover list, focusPreviousElement, and fireEvents.

      4. - -
      5. Return.

      6. -
      -
    10. - -
    11. -

      If document's showing hint popover list contains - endpoint:

      - -
        -
      1. Assert: endpoint's popover - attribute is in the Hint state.

      2. - -
      3. Run hide popover stack until given endpoint, - document's showing hint popover list, focusPreviousElement, - and fireEvents.

      4. - -
      5. Return.

      6. -
      -
    12. +
    13. Let endpointIsHint be true if document's showing hint popover + list contains endpoint; otherwise + false.

    14. -
    15. Run close entire popover list given document's showing hint - popover list, focusPreviousElement, and fireEvents.

    16. +
    17. Run hide popover stack until given document, endpoint, + Hint, focusPreviousElement, and + fireEvents.

    18. -
    19. If document's showing auto popover list does not contain - endpoint, then return.

    20. +
    21. If endpointIsHint, then return.

    22. -
    23. Run hide popover stack until given endpoint, document's - showing auto popover list, focusPreviousElement, and +

    24. Run hide popover stack until given document, endpoint, + Auto, focusPreviousElement, and fireEvents.

    -

    To hide popover stack until, given an HTML - element endpoint, a list popoverList, a boolean - focusPreviousElement, and a boolean fireEvents:

    +

    To hide popover stack until, given a Document document, an + HTML element or null endpoint, an Auto or Hint + stackType, a boolean focusPreviousElement, and a boolean + fireEvents:

      -
    1. Let repeatingHide be false.

    2. - -
    3. -

      Perform the following steps at least once:

      - -
        -
      1. Let lastToHide be null.

      2. +
      3. Let popoverList be document's showing auto popover list + if stackType is Auto; otherwise + document's showing hint popover list.

      4. -
      5. -

        For each popover in popoverList:

        +
      6. Let lastHideIndex be 0 if popoverList does not contain endpoint; otherwise the index of endpoint in + popoverList plus 1.

      7. -
          -
        1. If popover is endpoint, then break.

        2. +
        3. Let toHide be a slice of + popoverList from lastHideIndex, in + reverse order.

        4. -
        5. Set lastToHide to popover.

        6. -
        - +
      8. Let toRemain be a slice of + popoverList from 0 to lastHideIndex.

      9. -
      10. If lastToHide is null, then return.

      11. +
      12. For each popover of toHide: run + the hide popover algorithm given popover, + focusPreviousElement, fireEvents, false, and null.

      13. -
      14. -

        While lastToHide's popover visibility state is showing:

        +
      15. Let newPopoverList be document's showing auto popover + list if stackType is Auto; + otherwise document's showing hint popover list.

      16. -
          -
        1. Assert: popoverList is not empty.

        2. +
        3. Reverse newPopoverList.

        4. -
        5. Run the hide popover algorithm given the last item in - popoverList, focusPreviousElement, fireEvents, false, and - null.

        6. -
        - +
      17. +

        For each popover in + newPopoverList:

        -
      18. Assert: repeatingHide is false or popoverList's last - item is endpoint.

      19. +
          +
        1. If toRemain contains popover, + then continue.

        2. -
        3. Set repeatingHide to true if popoverList contains - endpoint and popoverList's last item is not endpoint, - otherwise false.

        4. +
        5. +

          Run the hide popover algorithm given popover, + focusPreviousElement, false, false, and null.

          -
        6. If repeatingHide is true, then set fireEvents to false.

        7. +

          This happens if popovers are shown whilst hiding popovers. For example, in + beforetoggle events. This is usually a developer + error, so user agents are encouraged to show a warning. In this additional hiding phase, + fireEvents is ignored, and false is used instead.

          +
        - -

        and keep performing them while repeatingHide is true.

    -

    The hide all popovers until - algorithm is used in several cases to hide all popovers that don't stay open when something - happens. For example, during light-dismiss of a popover, this algorithm ensures that we close only - the popovers that aren't related to the node clicked by the user.

    +

    The hide popover stack until algorithm is used in several cases to + hide all popovers that don't stay open when something happens. For example, during light-dismiss + of a popover, this algorithm ensures that we close only the popovers that aren't related to the + node clicked by the user.

    To find the topmost popover ancestor, given a Node - newPopoverOrTopLayerElement, a list popoverList, an HTML element or null source, and a boolean - isPopover, perform the following steps. They return an HTML element or null.

    + newPopoverOrTopLayerElement, an HTML element or + null source, and a boolean isPopover, perform the following steps. They + return an HTML element or null.

    -

    The topmost popover ancestor algorithm will return the topmost (latest in the - showing auto popover list) ancestor popover for the provided popover or top layer - element. Popovers can be related to each other in several ways, creating a tree of popovers. - There are two paths through which one popover (call it the "child" popover) can have a topmost - ancestor popover (call it the "parent" popover):

    +

    The topmost popover ancestor algorithm will return the topmost ancestor popover + for the provided popover or top layer element. Popovers can be related to each other in several + ways, creating a tree of popovers. There are two paths through which one popover (call it the + "child" popover) can have a topmost ancestor popover (call it the "parent" popover):

    1. The popovers are nested within each other in the node tree. In this case, the descendant popover is the "child" and its topmost ancestor popover is the "parent".

    2. -
    3. A popover trigger element (e.g., a button) has a popovertarget attribute pointing to a popover. In this case, - the popover is the "child", and the popover subtree the trigger element is in is the - "parent". The trigger element has to be in a popover and reference an open popover.

    4. +
    5. An element is the 'source' of the popover (e.g., a button with command in the Show Popover state). In this case, the + popover is the "child", and the popover subtree the trigger element is in is the "parent". The + trigger element has to be in a popover and reference an open popover.

    In each of the relationships formed above, the parent popover has to be strictly earlier in - the showing auto popover list than the child popover, or it does not form a valid - ancestral relationship. This eliminates non-showing popovers and self-pointers (e.g., a popover - containing an invoking element that points back to the containing popover), and it allows for the - construction of a well-formed tree from the (possibly cyclic) graph of connections. Only Auto popovers are considered.

    + the showing auto popover list or showing hint popover list than the + child popover, or it does not form a valid ancestral relationship. This eliminates non-showing + popovers and self-pointers (e.g., a popover containing an invoking element that points back to + the containing popover), and it allows for the construction of a well-formed tree from the + (possibly cyclic) graph of connections. Only Auto + and Hint popovers are considered.

    If the provided element is a top layer element such as a dialog which is not showing as a popover, then topmost popover ancestor will only look in the node tree @@ -91901,81 +91939,30 @@ dictionary DragEventInit : MouseEventInit { -

  • Let popoverPositions be an empty ordered map.

  • - -
  • Let index be 0.

  • - -
  • -

    For each popover of popoverList:

    - -
      -
    1. Set popoverPositions[popover] to - index.

    2. - -
    3. Increment index by 1.

    4. -
    -
  • - -
  • If isPopover is true, then set - popoverPositions[newPopoverOrTopLayerElement] to index.

  • - -
  • Increment index by 1.

  • - -
  • Let topmostPopoverAncestor be null.

  • - -
  • -

    Let checkAncestor be an algorithm which performs the following steps given - candidate:

    - -
      -
    1. If candidate is null, then return.

    2. - -
    3. Let okNesting be false.

    4. - -
    5. Let candidateAncestor be null.

    6. - -
    7. -

      While okNesting is false:

      - -
        -
      1. Set candidateAncestor to the result of running nearest inclusive open - popover given candidate.

      2. - -
      3. If candidateAncestor is null or popoverPositions does not - contain candidateAncestor, then return.

      4. - -
      5. Assert: candidateAncestor's popover attribute is not in the Manual or None state.

      6. +
      7. Let document be newPopoverOrTopLayerElement's node + document.

      8. -
      9. Set okNesting to true if isPopover is false, - newPopoverOrTopLayerElement's popover attribute - is in the Hint state, or - candidateAncestor's popover attribute is in the - Auto state.

      10. +
      11. Let combinedPopovers be document's showing auto popover + list extended with document's showing + hint popover list.

      12. -
      13. If okNesting is false, then set candidate to - candidateAncestor's parent in the flat tree.

      14. -
      -
    8. +
    9. Let popoverAncestorIndex be the index of the last item in combinedPopovers of which newPopoverOrTopLayerElement + is a flat tree descendant, otherwise -1.

    10. -
    11. Let candidatePosition be - popoverPositions[candidateAncestor].

    12. +
    13. Let sourceAncestorIndex be -1.

    14. -
    15. If topmostPopoverAncestor is null or - popoverPositions[topmostPopoverAncestor] is less than - candidatePosition, then set topmostPopoverAncestor to - candidateAncestor.

    16. -
    -
  • +
  • If source is not null, then set sourceAncestorIndex to the index of + the last item in combinedPopovers of which + source is a flat tree descendant, + otherwise -1.

  • -
  • Run checkAncestor given newPopoverOrTopLayerElement's parent node - within the flat tree.

  • +
  • Let ancestorIndex be the maximum of popoverAncestorIndex and + sourceAncestorIndex.

  • -
  • Run checkAncestor given source.

  • +
  • If ancestorIndex is -1, then return null.

  • -
  • Return topmostPopoverAncestor.

  • +
  • Return combinedPopovers[ancestorIndex].

  • @@ -91991,9 +91978,8 @@ dictionary DragEventInit : MouseEventInit {

    While currentNode is not null:

      -
    1. If currentNode's popover attribute is in - the Auto state or the Hint state, and currentNode's +

    2. If currentNode's opened in popover mode is "auto" or "hint", and currentNode's popover visibility state is showing, then return currentNode.

    3. @@ -92007,8 +91993,8 @@ dictionary DragEventInit : MouseEventInit {
    -

    To find the topmost auto or hint popover given a - Document document, perform the following steps. They return an To find the topmost auto or hint popover given + a Document document, perform the following steps. They return an HTML element or null.

      @@ -92061,21 +92047,15 @@ dictionary DragEventInit : MouseEventInit {

      To check popover validity for an HTML element - element given a boolean expectedToBeShowing, a boolean - throwExceptions, and a Document or null expectedDocument, - perform the following steps. They throw an exception or return a boolean.

      + element given a boolean expectedToBeShowing and a Document or + null expectedDocument, 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:

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

        2. - -
        3. Return false.

        4. -
        + data-x="attr-popover-none-state">No Popover state, then throw a + "NotSupportedError" DOMException.

      2. @@ -92110,14 +92090,7 @@ dictionary DragEventInit : MouseEventInit {
      3. element's fullscreen flag is set,

      4. -

        then:

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

        2. - -
        3. Return false.

        4. -
        +

        then throw an "InvalidStateError" DOMException.

      5. Return true.

      6. @@ -92194,20 +92167,17 @@ dictionary DragEventInit : MouseEventInit {
      -
      -

      To close entire popover list given a list popoverList, a - boolean focusPreviousElement, and a boolean fireEvents:

      +

      Each Document has a hint stack parent, which is an HTML element or null, initially null.

      -
        -
      1. -

        While popoverList is not empty:

        +
        +

        The hint stack parent tracks which item in the showing auto popover + list is the 'parent' of the first item in the showing hint popover list, or + null if the first item in showing hint popover list is not 'child' to an item in the + showing auto popover list.

        -
          -
        1. Run the hide popover algorithm given popoverList's last item, - focusPreviousElement, fireEvents, false, and null.

        2. -
        -
      2. -
      +

      Therefore, when the hint stack parent is not null, it will have an opened + in popover mode of "auto".

      The popover target attributes

      @@ -92334,10 +92304,18 @@ dictionary DragEventInit : MouseEventInit { data-x="popover-showing-state">showing, then run the hide popover algorithm given popover, true, true, false, and node.

      -
    1. Otherwise, if popover's popover visibility state is hidden and the result of running check popover - validity given popover, false, false, and null is true, then run show - popover given popover, false, and node.

    2. +
    3. +

      Otherwise:

      + +
        +
      1. Let validity be the result of running check popover validity + given popover, false, and null. If this throws an exception, catch it, and let + validity be false.

      2. + +
      3. If validity is true, then run show popover given + popover, false, and node.

      4. +
      +
    @@ -92372,8 +92350,9 @@ dictionary DragEventInit : MouseEventInit {

    "Light dismiss" means that clicking outside of a popover whose popover attribute is in the Auto state will close the popover. This is in addition to - how such popovers respond to close requests.

    + data-x="attr-popover-auto-state">Auto or Hint + state will close the popover. This is in addition to how such popovers respond to close requests.

    To light dismiss open popovers, given a PointerEvent @@ -92388,10 +92367,8 @@ dictionary DragEventInit : MouseEventInit {

  • Let document be target's node document.

  • -
  • Let topmostPopover be the result of running topmost auto popover - given document.

  • - -
  • If topmostPopover is null, then return.

  • +
  • If the result of running topmost auto or hint popover given + document is null, then return.

  • If event's type is "pointerdown", then: set document's popover @@ -92411,11 +92388,29 @@ dictionary DragEventInit : MouseEventInit {

  • Set document's popover pointerdown target to null.

  • -
  • If ancestor is null, then set ancestor to - document.

  • +
  • If sameTarget is false, then return

  • + +
  • Let endpointIsHint be true if document's showing hint + popover list contains ancestor; otherwise + false.

  • -
  • If sameTarget is true, then run hide - all popovers until given ancestor, false, and true.

  • +
  • Run hide popover stack until given document, + ancestor, Hint, false, and + true.

  • + +
  • Let autoEndpoint be ancestor.

  • + +
  • +

    If endpointIsHint, then set autoEndpoint to document's + hint stack parent.

    + +

    This means, if a hint popover is clicked, auto popovers are closed, except + those that are parent to the clicked hint popover.

    +
  • + +
  • Run hide popover stack until given document, + autoEndpoint, Auto, false, and + true.