Exposing a string targetSelector attribute to EventTiming performance entries.
- Category
- Performance
- Type
- New or changed feature
- Status
- Proposed (Chrome Proposed)
- Intent stage
- None
Summary
The Event Timing API (part of the Performance Timeline) is used to measure long-running user interactions. Each entry reports the event type, timeStamp, processing times, and total duration to next paint. Currently, each entry already reports the EventTarget (node), which is very important to actually find a reproduction use case from field data, in order to fix latency issues. This new feature additionally exposes a String representation of the EventTarget via a new `targetSelector` attribute of Event Timing API. Motivation: because observing Event Timing is asynchronous, and because the `target` value is a weak reference, and because interactions with a page often modify the page (e.g. clicking a cookie consent prompt, or a button to dismiss a modal dialog), it is fairly common that the `target` Node might have already disconnected from the DOM and become reporting as `null`. By capturing a light weight representation of the node (as a querySelector formatted string) we can keep a strong reference for reporting purposes.
Motivation
One of the more common developer paint points, and thus feedback, about Event Timing is that it can be hard to debug/diagnose when the event timing target value is empty, and this offers no remedy to reproduce locally. A workaround that is sometimes used is to save a targetSelector string value by registering event listeners, creating a map of all events and event target strings, and then later merging this with Event Timing entries once reporting from the performance api -- but this mostly negates the advantages of using the performance API in the first place.
Standards & signals
- Specification: https://github.com/w3c/event-timing/pull/160
- Firefox: No signal
- Safari: No signal
- Web developers: No signals
- Tracking bug: https://crbug.com/40887145
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=exposing-a-string-targetselector-attribute-to-eventtiming-performance-entries
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Exposing%20a%20string%20targetSelector%20attribute%20to%20EventTiming%20performance%20entries.
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Exposing%20a%20string%20targetSelector%20attribute%20to%20EventTiming%20performance%20entries.
- Baseline status: https://webstatus.dev/?q=Exposing%20a%20string%20targetSelector%20attribute%20to%20EventTiming%20performance%20entries.
Explainers: https://github.com/w3c/event-timing/pull/160