-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watcher support for elements not within the DOM #76
Comments
To make sure we solve this correctly, do you mind providing 1 or 2 examples of needing this functionality. That way we can make sure we are solving the right problem. e.g. in what valid cases should we try to watch a detached element. Often times, I can see that being an error, in what cases is it legit? |
The seemingly legit use-case is via lazy loading images with fixed dimensions and ghosting. Something like leveraging |
DM with @stefanpenner: In addition we may actually want to consider making Spaniel (in dev) explode if |
I believe that is safe, and would be an "honest" cross browser implementation, as it would only support what it could safely support across its browsers. Eventually if IE11 is dropped, we could choose to loosen. thoughts @asakusuma / @krisselden |
After DMing with @krisselden another proposed solve would be removing the caching of https://github.com/linkedin/spaniel/blob/v2-release/src/metal/scheduler.ts#L162-L188 If we set and memoized |
This PR: #79 should address this issue. |
Spaniel v2.4.6 does not provide support for elements being watched that are not within the DOM. Currently the
ElementScheduler
cachesgetBoundingClientRect
which is set during thewatch
phase. Elements not yet within the DOM return default values ongetBoundingClientRect
which are then cached within theElementScheduler
.spaniel/src/metal/scheduler.ts
Lines 176 to 188 in f2c580b
Thoughts on exposing a method within Spaniel to force a revalidation of cached
getBoundingClientRect
on elements being watched? Either on theWatcher
or exposing theW
(window proxy).The text was updated successfully, but these errors were encountered: