Re: [csswg-drafts] [cssom-view] Proposal: add Element.isVisible[toDocument] to detect if element is visible in the document. (#6850)

> `isVisibleToDocument` is an odd term (why is the document looking at elements?) that might make sense for implementors, but as an author I wouldn't understand it.

How about `isVisibleInDocument` ?

> If this is about whether `getBoundingClientRect()` will trigger more work, why not use a name that communicate that more clearly?

There are two known use cases:

1. Detect if the element is actually visible, e.g. for testing in puppeteer/playwright or similar. Joey linked to examples above.
2. Avoid forcing rendering in a skipped `content-visibility`. e.g. sites would wrap potentially expensive code such as `getBoundingClientRect` in an `isVisibleInDocument`.


-- 
GitHub Notification of comment by chrishtr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6850#issuecomment-1010363945 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 11 January 2022 21:13:27 UTC