-
Notifications
You must be signed in to change notification settings - Fork 672
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
[selectors-4] Add pseudo-class to differentiate loading from dynamically added content #8175
Comments
What element would :loaded match on? The root, or everything? |
How about an animation property that delays the start of the animation until the page finishes loading? The example uses DOMContentLoaded which is different from the load event. Are both cases interesting? What about transitions? Is this animations specific? Chrome has had issues where we transition from initial styles if computed styles are enforced while render-blocking stylesheets load. |
I've always thought that we should have pseudos that correspond to the 2 major document events - DOMContentLoaded and load. I've even implemented it in some projects that used css-like languages and , as pointed out a lot of people just do it with script. That and 'javascript seems to be executing' were really common classes that got added to the root, they seem like obviously useful things to me that would be nice to just add natively. I would totally support it and I think it should just match on the root and not on every element really - that matches more or less what people have done by attaching a class. |
On page load event is nice, but in most cases it's completely impractical because what you actually want to know is when the element is visible on screen, which is already declared non-implementable as a selector. |
Although, this can still be valid for top-layer-ish fixedpos components, e.g: dialogs, popups, lightboxes, cookie banners, etc. |
@flackr if it's only animations we're dealing with, perhaps we might instead consider a new sort of a value So a delayed animation could look like: .element {
animation: entry 200ms delayed(loaded);
} And the |
I think it might also be helpful for transitions. I've used the e.g.
|
A common developer frustration I've heard around animations is that there's not really a good way to animate new content without also animating it when the page loads. A common way developers work around this is to add a class to the root once the page has loaded. This class can be used on animation rules so that content which was initially visible doesn't animate in.
E.g.
Seems like it would be really useful to add this as a built-in pseudo-class. My strawman proposal would be to match the pseudo-class
:loaded
after the load event has been dispatched. Then developers could match this pseudo to specify entry animations only when an element was not part of the original document.The text was updated successfully, but these errors were encountered: