-
Notifications
You must be signed in to change notification settings - Fork 307
Add new mutation observer init options elementByAttributeFilter and elementFilter #885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
d1c9cb6
8dff3a0
e0b4bcb
cb4b0d9
f9d51aa
63b316d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3320,6 +3320,8 @@ dictionary MutationObserverInit { | |
boolean attributeOldValue; | ||
boolean characterDataOldValue; | ||
sequence<DOMString> attributeFilter; | ||
sequence<DOMString> elementFilterByAttribute; | ||
sequence<DOMString> elementLocalNameFilter; | ||
}; | ||
</pre> | ||
|
||
|
@@ -3398,6 +3400,19 @@ dictionary MutationObserverInit { | |
<a>attribute</a> mutations need to be | ||
observed and {{MutationObserverInit/attributes}} is true | ||
or omitted. | ||
|
||
<dt>{{MutationObserverInit/elementFilterByAttribute}} | ||
<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 for=/>element</a> | ||
<a for=Element>local names</a> (without <a for=Attr>namespace</a>) to observe | ||
changes to the presence of specific <a for=/>element</a> <a for=Element>local names</a> | ||
if not all <a for=/>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> | ||
|
@@ -3437,6 +3452,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/elementFilterByAttribute}} 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>. | ||
|
@@ -3453,6 +3476,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/elementFilterByAttribute}} 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 | ||
|
@@ -3594,6 +3625,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/elementFilterByAttribute}} is present, then: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this |
||
|
||
<ol> | ||
<li><p>Let <var>nodeAttributesList</var> be the set of local names of node's attributes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is node referring to here? I feel like this is lacking some references to other variables. |
||
|
||
<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>. | ||
AndrewRot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect a for each to be followed by a nested list so there's an |
||
<p>If none of the following are true | ||
|
||
<ul class=brief> | ||
<li>if <var>options</var>'s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/if// I think? Same below. If not I'd try to reword these to be more clearly true/false statements. |
||
{{MutationObserverInit/elementLocalNameFilter}} is present, and | ||
"<code>node.localName</code>" is in {{MutationObserverInit/elementLocalNameFilter}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is node.localName and why is it formatted this way? Is that a special value? |
||
|
||
<li><var>options</var>'s {{MutationObserverInit/elementFilterByAttribute}} is | ||
present, and <var>options</var>'s {{MutationObserverInit/elementFilterByAttribute}} | ||
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/elementFilterByAttribute}} is present,and <var>options</var>'s | ||
{{MutationObserverInit/elementFilterByAttribute}} 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>. | ||
|
Uh oh!
There was an error while loading. Please reload this page.