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
Use Infra to define mutation observers #609
Conversation
@smaug---- when the specification does
is this some kind of global search? And the goal is to remove them from each node's registered observer list? Seems quite expensive. |
https://www.w3.org/Bugs/Public/show_bug.cgi?id=22759#c9 by @travisleithead has the better model here (the first suggestion) that didn't make it into the specification. That would make how this works much more explicit. |
So, we could give each "registered observer" a "transient registered observer node list". When removing a node, in step 16 of https://whatpr.org/dom/609.html#concept-node-remove, aside from appending a new transient registered observer to node's registered observer list, we also append node to registered's transient registered observer node list. Then we could rewrite step 7 of https://whatpr.org/dom/609.html#dom-mutationobserver-observe to use this new node list on registered to remove the transient registered observers from those nodes. However, we also remove transient registered observers in https://whatpr.org/dom/609.html#notify-mutation-observers based on the observer field. Should @ajklein if you could help with this further formalizing of mutation observers that'd be appreciated. If it's too much to page in I can relate. |
no. MutationObserver has the list of transient observers, so it can just go through the list. |
I suspect that @smaug---- has this swapped in better than I do, have been out of DOM land for several years now... |
|
@ArkadiuszMichalski interested in reviewing this? |
@@ -3636,6 +3638,8 @@ that is a <a>document</a>. | |||
<a>node</a>'s <a>assigned slot</a>, if <a>node</a> is <a>assigned</a>, and <a>node</a>'s | |||
<a for=tree>parent</a> otherwise. | |||
|
|||
<p class="note no-backref">Each <a for=/>node</a> also has a <a>registered observer list</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each node has also ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The precedent in the document is "also has". And I think that's correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But which one reads better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"also has" reads more natural to me.
dom.bs
Outdated
<li><p><a for=list>For each</a> <var>node</var> of the <a>context object</a>'s | ||
<a for=MutationObserver>node list</a>, <a for=list>remove</a> all | ||
<a>transient registered observers</a> whose <a for="transient registered observers">source</a> is | ||
<var>registered</var> from <var>node</var>'s <a>registered observer list</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something weird with this sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you be more specific? I can't really find anything odd.
b21a1c3
to
46a5301
Compare
Fixes #132.
The main thing I still need to look into is figuring out how transient registered observers are actually removed, as the current text doesn't state that in much detail.
Preview | Diff