You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Although, now that I think about it, what if a node's style.overflow is "visible"? Won't your suggested code call a node invisible even though its content can be seen? If so, I'm afraid the shortcut doesn't avail, because we have to go get the computed style to tell what the overflow property is, as we do around
. Hoping I'm wrong. :-)
Erik
Big help, potentially! I'll ticket it to try and benchmark. Did you really mean "return true", or did you mean "false" (meaning "not visible")?
~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.
Hope it helps.
The text was updated successfully, but these errors were encountered:
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:
The text was updated successfully, but these errors were encountered: