diff --git a/dom.bs b/dom.bs index 81d03af1..bd504d56 100644 --- a/dom.bs +++ b/dom.bs @@ -3364,6 +3364,8 @@ dictionary MutationObserverInit { boolean attributeOldValue; boolean characterDataOldValue; sequence<DOMString> attributeFilter; + sequence<DOMString> elementByAttributeFilter; + sequence<DOMString> elementFilter; }; @@ -3442,6 +3444,19 @@ dictionary MutationObserverInit { attribute mutations need to be observed and {{MutationObserverInit/attributes}} is true or omitted. + +
{{MutationObserverInit/elementByAttributeFilter}} +
Set to a list of attribute + local names (without namespace) to observe changes + to the presence of an elements attributes. + +
{{MutationObserverInit/elementFilter}} +
Set to a list of element + local names (without namespace) to observe + changes to the presence of specific element local names + if not all element local names need to be + observed and {{MutationObserverInit/attributes}} is true + or omitted.
observer . {{disconnect()}} @@ -3479,6 +3494,14 @@ method steps are: exist, then set options["{{MutationObserverInit/characterData}}"] to true. +
  • If options's {{MutationObserverInit/elementByAttributeFilter}} is present and + options's {{MutationObserverInit/childList}} is omitted, then set + options's {{MutationObserverInit/childList}} to true. + +

  • If options's {{MutationObserverInit/elementFilter}} is present and + options's {{MutationObserverInit/childList}} is omitted, then set + options's {{MutationObserverInit/childList}} to true. +

  • If none of options["{{MutationObserverInit/childList}}"], options["{{MutationObserverInit/attributes}}"], and options["{{MutationObserverInit/characterData}}"] is true, then throw a @@ -3496,6 +3519,14 @@ method steps are: options["{{MutationObserverInit/characterData}}"] is false, then throw a TypeError. +

  • If options's {{MutationObserverInit/elementByAttributeFilter}} is present and + options's {{MutationObserverInit/childList}} is false, then throw a + TypeError. + +

  • If options's {{MutationObserverInit/elementFilter}} is present and + options's {{MutationObserverInit/childList}} is false, then throw a + TypeError. +

  • For each registered of target's registered observer list, if registered's @@ -3635,6 +3666,67 @@ method steps are:

    1. Assert: either addedNodes or removedNodes is not empty. +

    2. +

      If either options's' {{MutationObserverInit/elementFilter}} or + {{MutationObserverInit/elementByAttributeFilter}} is present, then: + +

        +
      1. Let filteredAddedNodes be an empty list. + +

      2. Let filterRemovedNodes be an empty list. + +

      3. +

        For each node in addedNodes: + +

          +
        1. Let nodeAttributesList be the set of local names of node's + attributes. + +

        2. +

          If none of the following are true + +

            +
          • options's {{MutationObserverInit/elementFilter}} is present, and the + node's localName is in {{MutationObserverInit/elementFilter}} + +
          • options's {{MutationObserverInit/elementByAttributeFilter}} is present, and + options's {{MutationObserverInit/elementByAttributeFilter}} contains any of the + attribute name in nodeAttributesList +
          + +

          then append node to filteredAddedNodes. +

        + +
      4. +

        For each node in removedNodes: + +

          +
        1. Let nodeAttributesList be the set of local names of node's + attributes. + +

        2. +

          If none of the following are true + +

            +
          • options's {{MutationObserverInit/elementFilter}} is present, and the + node's localName is in {{MutationObserverInit/elementFilter}} + +
          • options's {{MutationObserverInit/elementByAttributeFilter}} is present, and + options's {{MutationObserverInit/elementByAttributeFilter}} contains any of the + attribute names in nodeAttributesList +
          + +

          then append node to filterRemovedNodes. +

        + +
      5. Assert: either filteredAddedNodes or filteredRemovedNodes + is not empty. + +

      6. Set addedNodes to filteredAddedNodes + +

      7. Set removedNodes to filteredRemovedNodes +

      +
    3. Queue a mutation record of "childList" for target with null, null, null, addedNodes, removedNodes, previousSibling, and nextSibling.