On Jan 19, 2021, at 14:28 , Emilio Cobos Álvarez <emilio@mozilla.com mailto:emilio@mozilla.com> wrote:
~10% of the profile is under ResolveStyleLazily. That means that you're calling getComputedStyle in a display: none subtree.
Perhaps a bit counter-intuitively, I think you can basically eliminate that by checking something like:
let rect = ancestor.getBoundingClientRect();
if (rect.width == 0 || rect.height == 0)
return true;
That will also allow you to fix the style.{width,height} == '0' checks, which are bogus (it should use '0px'), and which can be removed with the snippet I posted above.
Emilio had a great idea. See this mail thread.
--
Err, yeah, I of course wanted to say "not visible".
If the node is zero size but has overflow, and you care about that, then you can check !element.getClientRects().length as the check instead.
-- Emilio
On 2/2/21 22:44, Erik Rose wrote: