@@ -3320,6 +3320,8 @@ dictionary MutationObserverInit {
33203320 boolean attributeOldValue;
33213321 boolean characterDataOldValue;
33223322 sequence<DOMString> attributeFilter;
3323+ sequence<DOMString> elementFilterByAttribute;
3324+ sequence<DOMString> elementLocalNameFilter;
33233325};
33243326</pre>
33253327
@@ -3398,6 +3400,19 @@ dictionary MutationObserverInit {
33983400 <a>attribute</a> mutations need to be
33993401 observed and {{MutationObserverInit/attributes}} is true
34003402 or omitted.
3403+
3404+ <dt> {{MutationObserverInit/elementFilterByAttribute}}
3405+ <dd> Set to a list of <a>attribute</a>
3406+ <a for=Attr>local names</a> (without <a for=Attr>namespace</a> ) to observe changes
3407+ to the presence of an elements <a>attributes</a> .
3408+
3409+ <dt> {{MutationObserverInit/elementLocalNameFilter}}
3410+ <dd> Set to a list of <a>element</a>
3411+ <a for=Element>local names</a> (without <a for=Attr>namespace</a> ) to observe
3412+ changes to the presence of specific <a>element</a> <a for=Element>local names</a>
3413+ if not all <a>element</a> <a for=Element>local names</a> need to be
3414+ observed and {{MutationObserverInit/attributes}} is true
3415+ or omitted.
34013416 </dl>
34023417
34033418 <dt><code><var> observer</var> . {{disconnect()}} </code>
@@ -3437,6 +3452,14 @@ method, when invoked, must run these steps:
34373452 <var> options</var> 's {{MutationObserverInit/characterData}} is omitted, then set
34383453 <var> options</var> 's {{MutationObserverInit/characterData}} to true.
34393454
3455+ <li><p> If <var> options</var> 's {{MutationObserverInit/elementFilterByAttribute}} is present and
3456+ <var> options</var> 's {{MutationObserverInit/childList}} is omitted, then set
3457+ <var> options</var> 's {{MutationObserverInit/childList}} to true.
3458+
3459+ <li><p> If <var> options</var> 's {{MutationObserverInit/elementLocalNameFilter}} is present and
3460+ <var> options</var> 's {{MutationObserverInit/childList}} is omitted, then set
3461+ <var> options</var> 's {{MutationObserverInit/childList}} to true.
3462+
34403463 <li><p> If none of <var> options</var> 's {{MutationObserverInit/childList}} ,
34413464 {{MutationObserverInit/attributes}} , and {{MutationObserverInit/characterData}} is true, then
34423465 <a>throw</a> a <code> TypeError</code> .
@@ -3453,6 +3476,14 @@ method, when invoked, must run these steps:
34533476 <var> options</var> 's {{MutationObserverInit/characterData}} is false, then <a>throw</a> a
34543477 <code> TypeError</code> .
34553478
3479+ <li><p> If <var> options</var> 's {{MutationObserverInit/elementFilterByAttribute}} is present and
3480+ <var> options</var> 's {{MutationObserverInit/childList}} is false, then <a>throw</a> a
3481+ <code> TypeError</code> .
3482+
3483+ <li><p> If <var> options</var> 's {{MutationObserverInit/elementLocalNameFilter}} is present and
3484+ <var> options</var> 's {{MutationObserverInit/childList}} is false, then <a>throw</a> a
3485+ <code> TypeError</code> .
3486+
34563487 <li>
34573488 <p> <a for=list>For each</a> <var> registered</var> of <var> target</var> 's
34583489 <a>registered observer list</a> , if <var> registered</var> 's
@@ -3594,6 +3625,60 @@ run these steps:
35943625<ol>
35953626 <li><p> Assert: either <var> addedNodes</var> or <var> removedNodes</var> <a for=set>is not empty</a> .
35963627
3628+ <li><p> If either <var> options</var> 's' {{MutationObserverInit/elementLocalNameFilter}} or
3629+ {{MutationObserverInit/elementFilterByAttribute}} is present, then:
3630+
3631+ <ol>
3632+ <li><p> Let <var> nodeAttributesList</var> be the set of local names of node's attributes.
3633+
3634+ <li><p> Let <var> filteredAddedNodes</var> be an empty <a for=/>list</a> .
3635+
3636+ <li><p> Let <var> filterRemovedNodes</var> be an empty <a for=/>list</a> .
3637+
3638+ <li>
3639+ <p> For each <var> node</var> in <var> addedNodes</var></a> .
3640+
3641+ <li>
3642+ <p> If none of the following are true
3643+
3644+ <ul class=brief>
3645+ <li> if <var> options</var> 's
3646+ {{MutationObserverInit/elementLocalNameFilter}} is present, and
3647+ "<code> node.localName</code> " is in {{MutationObserverInit/elementLocalNameFilter}}
3648+
3649+ <li><var> options</var> 's {{MutationObserverInit/elementFilterByAttribute}} is
3650+ present, and <var> options</var> 's {{MutationObserverInit/elementFilterByAttribute}}
3651+ contains any of the attribute name in <var> nodeAttributesList</var>
3652+ </ul>
3653+ <p> then:
3654+ <ol>
3655+ <li><p> <a for=queue>Enqueue</a> <var> record</var> node in <var> filteredAddedNodes</var>
3656+ </ol>
3657+
3658+ <li><p> For each <var> node</var> in <var> removedNodes</var></a> .
3659+ <li>
3660+ <p> If none of the following are true
3661+ <ul class=brief>
3662+ <li> if <var> options</var> 's
3663+ {{MutationObserverInit/elementLocalNameFilter}} is present, and
3664+ "<code> node.localName</code> " is in {{MutationObserverInit/elementLocalNameFilter}}
3665+ <li> if <var> options</var> 's
3666+ {{MutationObserverInit/elementFilterByAttribute}} is present,and <var> options</var> 's
3667+ {{MutationObserverInit/elementFilterByAttribute}} contains any of the attribute names
3668+ in <var> nodeAttributesList</var>
3669+ </ul>
3670+ <p> then:
3671+ <ol>
3672+ <li><p> <a for=queue>Enqueue</a> <var> record</var> node in <var> filterRemovedNodes</var>
3673+ </ol>
3674+
3675+ <li><p> Assert: either <var> filteredAddedNodes</var> or <var> filteredRemovedNodes</var> <a for=set>is not empty</a> .
3676+
3677+ <li><p> Set <var> addedNodes</var> to <var> filteredAddedNodes</var>
3678+
3679+ <li><p> Set <var> removedNodes</var> to <var> filteredRemovedNodes</var>
3680+ </ol>
3681+
35973682 <li><p> <a>Queue a mutation record</a> of "<code> childList</code> " for <var> target</var> with
35983683 null, null, null, <var> addedNodes</var> , <var> removedNodes</var> , <var> previousSibling</var> ,
35993684 and <var> nextSibling</var> .
0 commit comments