GoogleChrome / web-vitals

Essential metrics for a healthy site.
https://web.dev/vitals
Apache License 2.0
7.47k stars 410 forks source link

Move the support check to the top of the onINP() function #490

Closed philipwalton closed 3 months ago

philipwalton commented 3 months ago

Currently, the onINP() function will register a PerformanceObserver and callback in Firefox, despite the fact that it will not report any INP value (given that Firefox doesn't support the interactionId property).

This PR moves the feature detection code to the top level of the onINP() function, so it's essentially a noop in Firefox.