viz-observer
viz-observer copied to clipboard
Tidying up 2.0
I think there are some things left to explore before we publish 2.0. I just successfully updated my arrow library to use it and things are looking good! I would love to do some side by side comparisons to make sure perf and memory consumption have improved.
Todo List
- [ ] Update README/docs
- [x] think about adding a
takeRecordsmethod (This could be a 2.1 task) - [ ] investigate perf/memory consumption
- [ ] think about removing private methods (see https://github.com/samthor/viz-observer/pull/3#discussion_r1575417324) (This could be a 2.1 task)
- [ ] optimize root refreshes (see https://github.com/samthor/viz-observer/pull/3#discussion_r1568076902) (This could be a 2.1 task, although it might be consider breaking 🤔)
I honestly can't remember exactly my thought process years ago. But...
I'm a bit stuck on - absolute elements aren't reported correctly by the
IntersectionObserver with document.documentElement except if body
is set to position: relative.
The other option is to use document as the root, which works, but then
makes scrolling have the IntersectionObserver need to be recreated.
There could be a dual path, but working out what positioning a random
element is under is kind of tricky...
On Fri, Apr 26, 2024, 14:54 Chris Shank @.***> wrote:
I think there are some things left to explore before we publish 2.0. I just successfully updated https://github.com/ChrisShank/perfect-arrow/commit/0d25037a2bb083c2ffb626b819ae668dd16a340f my arrow library to use it and things are looking good! I would love to do some side by side comparisons to make sure perf and memory consumption have improved.
Todo List
- Update README/docs
- think about adding a takeRecords method
- investigate perf/memory consumption
- think about removing private methods (see #3 (comment) https://github.com/samthor/viz-observer/pull/3#discussion_r1575417324 )
- optimize root refreshes (see #3 (comment) https://github.com/samthor/viz-observer/pull/3#discussion_r1568076902 )
— Reply to this email directly, view it on GitHub https://github.com/samthor/viz-observer/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA5DEFVISNYYG6WO3G7BOLY7HMXFAVCNFSM6AAAAABG2DAOIGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DIOJVHE4TKMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
except if
bodyis set toposition: relative.
Ya its a tough problem and I wonder if it's a browser bug or just an unintended quirk. I currently lean towards very explicitly documenting this edge case so consumers can make the necessary change.
Addressing some things here in #5
It's probably a reasonable compromise if this API is sort of a pseudo-polyfill for a feature that we personally want to exist. that is, imagine a world where one browser has this, and this was a polyfill—you could say you need to do this odd thing that mostly has little effect on the page.
fun fact this approach is transiently being used in the css anchoring pollyfill https://github.com/oddbird/css-anchor-positioning/blob/main/src/polyfill.ts#L2