GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.02k stars 9.32k forks source link

misc: deduplicate all the dom helpers #15960

Closed connorjclark closed 2 months ago

connorjclark commented 2 months ago

fixes https://github.com/GoogleChrome/lighthouse/issues/11992

This reduces 4 instances of find to 1. I also adopted treemap's default second param to the canonical instance in DOM.

brendankenny commented 2 months ago

Could it be a standalone function that these files could import and that dom.js could use as well? Feels weird to pull in and instantiate all of DOM for this one function that's not static only for (extremely) historical reasons.

connorjclark commented 2 months ago

That's a reasonable further refactor. Note that treemap uses createElement/createChildOf too.