catchpoint / WebPageTest.agent

Cross-platform WebPageTest agent
Other
213 stars 138 forks source link

Selectively extract element information for LCP and CLS events #565

Closed pmeenan closed 2 years ago

pmeenan commented 2 years ago

Fix https://github.com/WPO-Foundation/wptagent/issues/564

Avoids iterating over every property of the elements and tripping feature usage flags.

This should also reduce the overhead of the injected script slightly and extracts everything the UI needs to do the LCP and CLS analysis.

The element timing and paint timing observers were not being used yet so leave those out until they are actually added to the output.

stoyan commented 2 years ago

looks good, I commented on your fork accidentally instead of here

pmeenan commented 2 years ago

@stoyan fixed most of the nits - only one I wasn't 100% confident in was going to the dotted notation for the event attributes in case some of the attributes were missing sometimes. Maybe that's not a valid concern or there's a better way to fail gracefully (if so, happy to make that change too).