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

Clarify Element Timing's handling of pseudo-elements #74

Open
brendankenny opened this issue Jan 19, 2023 · 1 comment
Open

Clarify Element Timing's handling of pseudo-elements #74

brendankenny opened this issue Jan 19, 2023 · 1 comment

Comments

@brendankenny
Copy link

The spec doesn't appear to say how Element Timing for pseudo-elements should be handled. A surprising number of sites put large content in pseudo-elements, so explicit support would be helpful for performance measurements and downstream specs like LCP.

Current browser behavior:

Chrome appears to be the only browser where support (or lack) is observable, but please correct me if I'm missing an entryType somewhere.

  • In Chrome, Element Timing will include timing for images in a background-image on a pseudo-element (example using a background image in ::after). The element property will be set to the originating element, but the intersectionRect, naturalWidth, naturalHeight, and url will all be for the actual image painted in the pseudo-element.

    This is perhaps the best that can be done, since it's not possible to have a JS reference to the pseudo-element itself. The image information in the entry is usually enough to figure out what exactly is being referred to, but an additional annotation somewhere to explicitly mark the entry as referring to a pseudo-element could be helpful for automated tools to know where to look.

  • Again in Chrome, Element Timing will not include timing for images in a more-or-less identical page but using content in a pseudo-element to add an image (example using content in ::after). As a result, the smaller text is determined to be the LCP element instead of the larger image.

@clelland
Copy link
Collaborator

It would be good to align this with Paint Timing, which specifically includes pseudo elements (regardless of the way that their content is declared)

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