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

Conversation

nathaneliason
Copy link

@nathaneliason nathaneliason commented Jun 16, 2022

https://w3c.github.io/IntersectionObserver/#pending-initial-observation describes an additional requirement for skipping document rendering in the HTML Event Loops Processing Model, one which is not documented in the Unnecessary rendering portion of the Update the rendering step. This change adds this requirement directly to the processing model spec.

I'll follow up with a corresponding change to w3c/IntersectionObserver to close corresponding issue w3c/IntersectionObserver#498.

Fixes #8015


/infrastructure.html ( diff )
/webappapis.html ( diff )

…as no pending initial IntersectionObserver targets before skipping rendering.
@nathaneliason
Copy link
Author

PTAL @domenic -- thanks in advance!

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

Sorry for the delay! I'll try to be more prompt about this going forward.

Basically I am not sure how to rigorously implement what you're saying here, and I'm worried that it's a symptom of deeper problems with the IntersectionObserver spec.

<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>

<p>The <code>Document</code> does not have <span>pending initial IntersectionObserver
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</span>.</p>

<p>A <code>Document</code> is said to have <dfn>pending initial IntersectionObserver
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

targets</dfn> if there is at least one <span>IntersectionObserver</span> meeting these
criteria:</p>
<ol 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

criteria:</p>
<ol class="brief">
<li>The <span data-x="IntersectionObserver">observer</span>'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.

<p>A <code>Document</code> is said to have <dfn>pending initial IntersectionObserver
targets</dfn> if there is at least one <span>IntersectionObserver</span> 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
data-x="dom-IntersectionObserver-root">root</span> is in the <code>Document</code> (for
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?

<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>
</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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add IntersectionObserver target requirement to Event Loops Processing Model
2 participants