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
Observing the entire document for everything may be too heavy? #41
Comments
You're absolutely right. As far as I can tell, this polyfill won't be able to detect Mutations within ShadowRoots which is a moving target. See also whatwg/dom#533 (comment) for more thoughts on a somewhat related note. |
@trusktr light/shadow trees, what does the "light" means? |
resize-observer-polyfill/src/ResizeObserverController.js
Lines 162 to 169 in a3ae98b
Here this triggers
refresh
, which makes all ResizeObservers check for size changes on any change of anything in the DOM.This seems like it may be a little heavy.
Maybe we can instead
<style>
elements in the top-level light tree.broadcastActive
on allResizeObserver
s in the light tree only on these changes.ResizeObserver
, listen to attribute changes only on that element directly (as opposed to attribute changes of all elements that exist in the document).broadcastActive
on the element'sResizeObserver
s only on these changesResizeObserverSPI
and making a new one, and when ever a new one is made it happens relative to an element's new location in some tree, therefore the controller or SPI can traverse up the tree to determine what is the root (document or shadow root) and use the associated MutationObserver.Currently, I don't think observing the
document
considers what happens in Shadow roots, right? Because aMutationObserver
won't cross the boundary, because shadow roots aren't (grand)children of any element in the document, and if they aremode: 'closed'
then they are not even referenced from any elements in thedocument
.So that's why we need a controlling mechanism in each light/shadow tree.
The text was updated successfully, but these errors were encountered: