Skip to content

Intersection observer and mark paint timing steps should run after (or during) "update the rendering", not before. #8277

Closed

Description

@emilio

https://html.spec.whatwg.org/#update-the-rendering says that step 14 is:

For each fully active Document in docs, run the update intersection observations steps for that Document, passing in now as the timestamp

Same for mark paint timing.

And step 16 is:

For each fully active Document in docs, update the rendering or user interface of that Document and its browsing context to reflect the current state.

Which is presumably when layout and style updates happen, or at least that's where ResizeObserver expects them to happen: https://drafts.csswg.org/resize-observer/#html-event-loop

It seems to me like IntersectionObserver and mark paint timing should happen at least after updating layout and style, not before. That's what happens in Gecko and I'd be extremely surprised if it wasn't what happens in other browsers. ResizeObserver needs to be during, because it can run script and cause further layout and style changes.

cc @rniwa @Loirooriol

Activity

  1. added
    topic: rendering
    agenda+
    on Sep 9, 2022
  2. Loirooriol commented on Sep 9, 2022

    @Loirooriol
    Contributor

    Quick test:

    new IntersectionObserver(() => console.log("IntersectionObserver")).observe(document.documentElement);
    new ResizeObserver(() => console.log("ResizeObserver")).observe(document.documentElement);

    Gecko and Blink: 1st ResizeObserver, 2nd IntersectionObserver
    WebKit: 1st IntersectionObserver, 2nd ResizeObserver

  3. added
    interop
    on Sep 9, 2022
  4. removed
    agenda+
    on Sep 30, 2022
  5. added 4 commits that reference this issue on Oct 2, 2022
    4fe9ed2
    5d4529f
    2294d0b
    7b7b52e
  6. added a commit that references this issue on Oct 4, 2022
    e43abf1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interoptopic: rendering

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions