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

HTML spec needs further changes in IntersectionObserver for proper integration #464

Open
zcorpan opened this issue Oct 22, 2020 · 1 comment

Comments

@zcorpan
Copy link
Member

zcorpan commented Oct 22, 2020

Follow-up to #427

In whatwg/html#6097 I tried to update the HTML spec to use the new terms, but found additional issues.

  • isIntersecting is not referenceable without referring to that API. Specifying it as an internal slot instead would help. Doing this for all things in the spec might be better than playing whack-a-mole.
  • Similarly for target. https://w3c.github.io/IntersectionObserver/#dom-intersectionobserverentry-target (There is a term "target", but .target does not use it, and it's not clear if it's a property/internal slot of an IntersectionObserver instance, or a general spec term.)
  • HTML initializes a new IntersectionObserver, which requires specifying a callback. Currently, this reads:

The callback is these steps, with arguments entries and observer:

  1. For each entry in entries [ using a method of iteration which does not trigger developer-modifiable array accessors or iteration hooks ] :

So... we need a way to enumerate entries, but without triggering developer-modifiable array accessors or iteration hooks. I'm not entirely sure how to solve this concretely, but maybe @annevk or @domenic can advise?

In addition, @annevk mentioned this in IRC: https://w3c.github.io/IntersectionObserver/#initialize-new-intersection-observer says in step 8:

The thresholds attribute getter will return this sorted thresholds list.

This should instead set an internal slot, and the definition of thresholds getter should say to return the value of that internal slot.

@domenic
Copy link

domenic commented Oct 22, 2020

It would be ideal if HTML didn't initialize JavaScript-facing IntersectionObserver objects at all. Instead there should be algorithms like "add intersection observer steps", which takes a series of spec steps, which HTML can use. Then the IntersectionObserver constructor would call "add intersection observer steps" with the steps being to invoke the provided callback.

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

No branches or pull requests

2 participants