-
Notifications
You must be signed in to change notification settings - Fork 9
Description
This may be a known issue (or, if not known, "expected" for some), but it was surprising to me, and I haven't seen it discussed so I thought I'd open an issue. Worst case, it can be about adding documentation for this behavior.
First, it seems that style observer callbacks are not fired for display: none elements (or descendants of a display: none element) โ I realized that soon after I started to use the library, but I don't find it particularly unexpected (I assume it is a side effect of using transitions to detect changes, since transitions don't run on hidden elements). Thankfully, the callbacks are called when the element becomes visible again, if the observed properties changed since the last time they were called. That seems to be the work of this RenderedObserver class, which is instantiated for each new ElementStyleObserver.
Unfortunately, in my application, I sometimes want to observe properties on elements whose display property is the infamous contents value. Perhaps surprisingly, it works perfectly! Except that RenderedObserver does not seem to do "its thing" on these elements: if the element becomes hidden temporarily (either due to its own display changing to hidden, or to an ancestor being hidden), and the observed properties happen to change while it's hidden, the callback does NOT get called when the element becomes visible again.
Can anything be done about this, or not? Thank you so much. ๐