Re: [csswg-drafts] [cssom-view] {element, elements, nodes}FromPoint but without restricting to the viewport clip? (#4122)

> Why can't they use `IntersectionObserver` for those though? (The "v1" spec doesn't check for visibility, but the "v2" one does.)

I wanted to respond here as one of the motivating use cases for Emilio bringing this issue up for discussion. I did [try using the Intersection Observer API](https://github.com/mozilla/price-tracker/issues/319#issuecomment-516497169) (I believe v2 based on your description). I saw about a 20% performance improvement compared to the 80% improvement using `elementsFromPoint` described in the same thread.

My use case differs in a couple of key ways from what seems to be the optimal use case for `IntersectionObserver`:
1. We want to check visibility for every single element on the page, not just a handful of say, ads. My sample page had upwards of 6000 elements, which means 6000 observers.
2. We only want to check once, not monitor changes over time. It seems like overkill to walk the DOM and attach an observer to each element only to remove it after the first event.

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

Received on Tuesday, 30 July 2019 17:00:05 UTC