@@ -3320,6 +3320,8 @@ dictionary MutationObserverInit {
3320
3320
boolean attributeOldValue;
3321
3321
boolean characterDataOldValue;
3322
3322
sequence<DOMString> attributeFilter;
3323
+ sequence<DOMString> elementFilterByAttribute;
3324
+ sequence<DOMString> elementLocalNameFilter;
3323
3325
};
3324
3326
</pre>
3325
3327
@@ -3398,6 +3400,19 @@ dictionary MutationObserverInit {
3398
3400
<a>attribute</a> mutations need to be
3399
3401
observed and {{MutationObserverInit/attributes}} is true
3400
3402
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.
3401
3416
</dl>
3402
3417
3403
3418
<dt><code><var> observer</var> . {{disconnect()}} </code>
@@ -3437,6 +3452,14 @@ method, when invoked, must run these steps:
3437
3452
<var> options</var> 's {{MutationObserverInit/characterData}} is omitted, then set
3438
3453
<var> options</var> 's {{MutationObserverInit/characterData}} to true.
3439
3454
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
+
3440
3463
<li><p> If none of <var> options</var> 's {{MutationObserverInit/childList}} ,
3441
3464
{{MutationObserverInit/attributes}} , and {{MutationObserverInit/characterData}} is true, then
3442
3465
<a>throw</a> a <code> TypeError</code> .
@@ -3453,6 +3476,14 @@ method, when invoked, must run these steps:
3453
3476
<var> options</var> 's {{MutationObserverInit/characterData}} is false, then <a>throw</a> a
3454
3477
<code> TypeError</code> .
3455
3478
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
+
3456
3487
<li>
3457
3488
<p> <a for=list>For each</a> <var> registered</var> of <var> target</var> 's
3458
3489
<a>registered observer list</a> , if <var> registered</var> 's
@@ -3594,6 +3625,60 @@ run these steps:
3594
3625
<ol>
3595
3626
<li><p> Assert: either <var> addedNodes</var> or <var> removedNodes</var> <a for=set>is not empty</a> .
3596
3627
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
+
3597
3682
<li><p> <a>Queue a mutation record</a> of "<code> childList</code> " for <var> target</var> with
3598
3683
null, null, null, <var> addedNodes</var> , <var> removedNodes</var> , <var> previousSibling</var> ,
3599
3684
and <var> nextSibling</var> .
0 commit comments