Skip to content

Commit

Permalink
Add mutation observer init options elementHasAttributeNameFilter and …
Browse files Browse the repository at this point in the history
…elementLocalNameFilter
  • Loading branch information
arottier committed Aug 12, 2020
1 parent 88c2569 commit 020ee4a
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3398,6 +3398,19 @@ dictionary MutationObserverInit {
<a>attribute</a> mutations need to be
observed and {{MutationObserverInit/attributes}} is true
or omitted.

<dt>{{MutationObserverInit/elementHasAttributeNameFilter}}
<dd>Set to a list of <a>attribute</a>
<a for=Attr>local names</a> (without <a for=Attr>namespace</a>) to observe changes
to the presence of an elements <a>attributes</a>.

<dt>{{MutationObserverInit/elementLocalNameFilter}}
<dd>Set to a list of <a>element</a>
<a for=Element>local names</a> (without <a for=Attr>namespace</a>) to observe
changes to the presence of specific <a>element</a> <a for=Element>local names</a>
if not all <a>element</a> <a for=Element>local names</a> need to be
observed and {{MutationObserverInit/attributes}} is true
or omitted.
</dl>

<dt><code><var>observer</var> . {{disconnect()}}</code>
Expand Down Expand Up @@ -3437,6 +3450,14 @@ method, when invoked, must run these steps:
<var>options</var>'s {{MutationObserverInit/characterData}} is omitted, then set
<var>options</var>'s {{MutationObserverInit/characterData}} to true.

<li><p>If <var>options</var>'s {{MutationObserverInit/elementHasAttributeNameFilter}} is present and
<var>options</var>'s {{MutationObserverInit/childList}} is omitted, then set
<var>options</var>'s {{MutationObserverInit/childList}} to true.

<li><p>If <var>options</var>'s {{MutationObserverInit/elementLocalNameFilter}} is present and
<var>options</var>'s {{MutationObserverInit/childList}} is omitted, then set
<var>options</var>'s {{MutationObserverInit/childList}} to true.

<li><p>If none of <var>options</var>'s {{MutationObserverInit/childList}},
{{MutationObserverInit/attributes}}, and {{MutationObserverInit/characterData}} is true, then
<a>throw</a> a <code>TypeError</code>.
Expand All @@ -3453,6 +3474,14 @@ method, when invoked, must run these steps:
<var>options</var>'s {{MutationObserverInit/characterData}} is false, then <a>throw</a> a
<code>TypeError</code>.

<li><p>If <var>options</var>'s {{MutationObserverInit/elementHasAttributeNameFilter}} is present and
<var>options</var>'s {{MutationObserverInit/childList}} is false, then <a>throw</a> a
<code>TypeError</code>.

<li><p>If <var>options</var>'s {{MutationObserverInit/elementLocalNameFilter}} is present and
<var>options</var>'s {{MutationObserverInit/childList}} is false, then <a>throw</a> a
<code>TypeError</code>.

<li>
<p><a for=list>For each</a> <var>registered</var> of <var>target</var>'s
<a>registered observer list</a>, if <var>registered</var>'s
Expand Down Expand Up @@ -3594,6 +3623,60 @@ run these steps:
<ol>
<li><p>Assert: either <var>addedNodes</var> or <var>removedNodes</var> <a for=set>is not empty</a>.

<li><p>If either <var>options</var>'s' {{MutationObserverInit/elementLocalNameFilter}} or
{{MutationObserverInit/elementHasAttributeNameFilter}} is present, then:

<ol>
<li><p>Let <var>nodeAttributesList</var> be <var>nodeAttributesList</var> of the node's attributes, "<code>node.getAttributeNames()</code>".

<li><p>Let <var>filteredAddedNodes</var> be an empty <a for=/>list</a>.

<li><p>Let <var>filterRemovedNodes</var> be an empty <a for=/>list</a>.

<li>
<p>For each <var>node</var> in <var>addedNodes</var></a>.

<li>
<p>If none of the following are true

<ul class=brief>
<li>if <var>options</var>'s
{{MutationObserverInit/elementLocalNameFilter}} is present, and
"<code>node.localName</code>" is in {{MutationObserverInit/elementLocalNameFilter}}

<li><var>options</var>'s {{MutationObserverInit/elementHasAttributeNameFilter}} is
present,and <var>options</var>'s {{MutationObserverInit/elementHasAttributeNameFilter}}
contains any of the attribute name in <var>nodeAttributesList</var>
</ul>
<p>then:
<ol>
<li><p><a for=queue>Enqueue</a> <var>record</var> node in <var>filteredAddedNodes</var>
</ol>

<li><p>For each <var>node</var> in <var>removedNodes</var></a>.
<li>
<p>If none of the following are true
<ul class=brief>
<li>if <var>options</var>'s
{{MutationObserverInit/elementLocalNameFilter}} is present, and
"<code>node.localName</code>" is in {{MutationObserverInit/elementLocalNameFilter}}
<li>if <var>options</var>'s
{{MutationObserverInit/elementHasAttributeNameFilter}} is present,and <var>options</var>'s
{{MutationObserverInit/elementHasAttributeNameFilter}} contains any of the attribute names
in <var>nodeAttributesList</var>
</ul>
<p>then:
<ol>
<li><p><a for=queue>Enqueue</a> <var>record</var> node in <var>filterRemovedNodes</var>
</ol>

<li><p>Assert: either <var>filteredAddedNodes</var> or <var>filteredRemovedNodes</var> <a for=set>is not empty</a>.

<li><p>Set <var>addedNodes</var> to <var>filteredAddedNodes</var>

<li><p>Set <var>removedNodes</var> to <var>filteredRemovedNodes</var>
</ol>

<li><p><a>Queue a mutation record</a> of "<code>childList</code>" for <var>target</var> with
null, null, null, <var>addedNodes</var>, <var>removedNodes</var>, <var>previousSibling</var>,
and <var>nextSibling</var>.
Expand Down

0 comments on commit 020ee4a

Please sign in to comment.