Skip to content
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

Add IntersectionObserver target requirement to Event Loops Processing Model #8016

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3965,9 +3965,13 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<ul class="brief">
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#run-the-update-intersection-observations-steps">run the update intersection observations steps</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#intersectionobserver"><code>IntersectionObserver</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#intersectionobserver-implicit-root-observer"><code>implicit root observer</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#intersectionobserverentry"><code>IntersectionObserverEntry</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#dictdef-intersectionobserverinit"><code>IntersectionObserverInit</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-observe" data-x="dom-IntersectionObserver-observe"><code>observe</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-unobserve" data-x="dom-IntersectionObserver-unobserve"><code>unobserve</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-root" data-x="dom-IntersectionObserver-root"><code>root</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-observationtargets-slot" data-x="dom-IntersectionObserver-observedtargets-slot"><code>slot</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#dom-intersectionobserverentry-isintersecting" data-x="dom-IntersectionObserverEntry-isIntersecting"><code>isIntersecting</code></dfn></li>
<li><dfn data-x-href="https://w3c.github.io/IntersectionObserver/#dom-intersectionobserverentry-target" data-x="dom-IntersectionObserverEntry-target"><code>target</code></dfn></li>
</ul>
Expand Down Expand Up @@ -96586,12 +96590,30 @@ import "https://example.com/foo/../module2.mjs";</code></pre>

<li>
<p><i>Unnecessary rendering</i>: Remove from <var>docs</var> all <code>Document</code> objects
which meet both of the following conditions:</p>
which meet all of the following conditions:</p>

<ul class="brief">
<ul>
<li>The user agent believes that updating the rendering of the <code>Document</code>'s <span
data-x="concept-document-bc">browsing context</span> would have no visible effect, and</li>
<li>The <code>Document</code>'s <span>map of animation frame callbacks</span> is empty.</li>
<li>
<p>The <code>Document</code> does not have <span>pending initial IntersectionObserver
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>The <code>Document</code> does not have <span>pending initial IntersectionObserver
<p>The <code>Document</code> does not have <span>pending initial <code>IntersectionObserver</code>

targets</span>.</p>

<p>A <code>Document</code> is said to have <dfn>pending initial IntersectionObserver
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>A <code>Document</code> is said to have <dfn>pending initial IntersectionObserver
<p>A <code>Document</code> <var>document</var> is said to have <dfn>pending initial <code>IntersectionObserver</code>

targets</dfn> if there is at least one <span>IntersectionObserver</span> meeting these
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
targets</dfn> if there is at least one <span>IntersectionObserver</span> meeting these
targets</dfn> if there is at least one <code>IntersectionObserver</code> <var>observer</var> meeting these

criteria:</p>
<ol class="brief">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ol class="brief">
<ul class="brief">

<li>The <span data-x="IntersectionObserver">observer</span>'s <span
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<li>The <span data-x="IntersectionObserver">observer</span>'s <span
<li><var>observer</var>'s <span

data-x="dom-IntersectionObserver-root">root</span> is in the <code>Document</code> (for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is in the Document" is not precise enough. For example, how does this interact with shadow DOM?

I suspect you want to check if its [shadow-including root] is document.

the <span>top-level browsing context</span>, this includes any <span
data-x="implicit root observer">implicit root observers</span>).</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this parenthetical at all. Parentheticals usually restate what's previous to them, but from what I can tell this is just a totally different criterion. It's saying something like "in addition to the two bullet points here, a Document also has pending initial IntersectionObserver targets if its browsing context is a top-level browsing context and there exists any IntersectionObserver whose root is null."

But even that doesn't make sense... What if there's an IntersectionObserver with null root in tab A, and tab B is a top-level browsing context whose Document we're considering? You need to scope this to the Document under consideration somehow. And I don't see how to do that, if the IntersectionObserver's root is null... then it has no connection to a Document, and it's just floating freely, disconnected from any document or browsing context.

This might just be something very broken about the IntersectionObserver spec?

<li> The <span data-x="IntersectionObserver">observer</span> has at least one
<em>target</em> in its <span data-x="dom-IntersectionObserver-observedtargets-slot">
ObservationTargets slot</span> for which no <span>IntersectionObserverEntry</span> has
yet been queued.</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what the latter part of this sentence means. So I have an observer, and I look at observer.[[ObservationTargets]]. That's a list... of what, the IntersectionObserver spec doesn't say. But how do I go from a target object target, to a boolean saying whether or not an IntersectionObserverEntry has been queued for that target? Do I need to loop over some global list of queued IntersectionObserverEntrys? Where is that list?

</ol>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</ol>
</ol>

</li>
</ul>
</li>

Expand Down