naugtur / insertionQuery

Non-dom-event way to catch nodes showing up. And it uses selectors.
Other
193 stars 32 forks source link

First frame after insertion FOUC #34

Open dy opened 4 years ago

dy commented 4 years ago

That doesn't seem to be mentioned in readme, but the callback skips at least one frame after the element is inserted to DOM. So for example if there's initializer function for a rule, that adds some styles or content to an element that is added to DOM, the element still appears in DOM unstyled for a single frame, then the rule is hit. That creates FOUC. I guess that can be prevented by hiding element for that frame in some way... That is the case for spect. selector-observer doesn't have that issue.

naugtur commented 2 years ago

Can you share a reproduction case? I'm not sure I understand the problem.

Erudition commented 1 year ago

set timeout lower than the duration of one frame, maybe? see the config