-
Notifications
You must be signed in to change notification settings - Fork 25
renderpriority: Should it be an HTML attribute or a CSS property #200
Comments
/cc @noahlemen |
I wonder if the fact that this is no-op without I would suspect that values indicating priority might be useful - for example, it's easy to imagine a page having many hidden menus that could be updated where you may want to prioritize one that is known to be used more frequently. Another question that comes to mind around priority, though: how would priority of the attribute version interact with calls to the imperative version? I would assume that the imperative version would always take highest priority. |
Having a CSS property for this also has a problem that you can't really apply this to a CSS class. Or rather, you can't have a per-element control without inline style or a very specific selector. I'm kind of leaning towards attribute for these reasons
That's an excellent point!
I think about this as having a many different sources asking for updates. So if one source is saying "idle priority -- whenever you get a chance", and another source is saying "must be updated soon", then the obvious choice is to update the element soon, and resolve both promises (if there are promises). Translated into a description, I would say that it picks the highest priority of any request -- whether it's multiple |
How about "auto" means the UA choses based on the semantics of the style etc. |
That sounds good. Would |
Auto would do it based on style / UA heuristics. It would basically be a no-op vs our current behavior for
|
I'm not certain this is something we'd actually use, but I'm trying to think through the implications of nested renderPriority. Would renderPriority for the child here no-op without
|
That's an interesting question. Here's how I think about it:
in the above, renderPriority has no effect and contents of
in the above,
in the above, everything is updated always (although we're having some discussion about it in #201 ). This is because nothing is preventing the updates in the first place, so it doesn't matter what the So what happens in the following?
Since this looks more like the second example, I would lean towards saying that this has no effect in that the contents of the The alternative here is since we're already in some non-immediate level of updates, we can downgrade |
This was going to be my follow-up question 🙂 I'd agree that taking the route of these scenarios having no effect seems simpler and less pitfall-prone, especially when considering the inverted-priority case. |
I think renderpriority is sticking as a name (#205 suggested different case, per guidelines). So I'm going to close this |
Agree with @noahlemen that this seems more appropriate for CSS if it's tied (and maybe even if it's only loosely tied) to
But we have several options to solve that?
@vmpstr, I don't understand this argument. You can be as broad or narrow as you like with CSS selectors. It feels pretty foreign that you have to go "elsewhere" to essentially "tweak" |
I've spent some time thinking about this and I keep coming back to the question of what is the difference between attributes and properties. So here comes my philosophical rant :) It is absolutely true that CSS can be as broad or specific as one wants, but does that mean that all attributes are better suited as CSS properties? Some examples that come to mind are things like There are things that attributes allow that are difficult in CSS. For instance, having UA change the attribute value is not easy/possible with CSS. But I think that's pretty much it. So then the criteria must be something else since the UA doesn't change most other attributes we have. To me, CSS spells out how things should look and each property has text that specifies its interactions with sizes, positions, whether it's painted or not, what to do with overflow, etc. Attributes on the other hand specify how things should behave. There are some CSS exceptions. For example, Another example is Now the rest of my argument hinges on this model. If it's not correct then I'd like to understand how to think about this better. Coming back to This to me supports the idea that </philosophical-rant> I think the more practical question is how will this attribute/property be used. If it will be used as set-it-and-forget-it type of thing, and apply to basically all elements that have At this point, I'm still on the fence about what to do, so I would really appreciate some input in how I should think about this problem. |
This has an important implication that is worth calling out: CSS can change depending on an attribute. Therefore, the developer can style the page in response to a UA action that modifies an attribute, without script. At the moment I don't see of an application of this to the |
I think the point that "if this is a CSS property, then it can still be controlled by an attribute due to the power of selectors" is very good. This does make it seem that the option to do it in CSS is strictly better and more flexible. I feel like that argument can be made for most properties, so then I'd like to understand if it's always correct to do things in CSS, and let developers control it by an attribute via attribute selectors if they wish to do so (sorry to go off on a tangent :) ) |
I just thought add that in #211 I suggested we may be able to express the hint that the content should be prepared for rendering even though it's hidden with a will-change value, not necessarily needing a new css property or html attribute. I.e. will-change: content-visibility Would express the following: This fits with the way will-change is used on other properties to prepare for changes in value, e.g. opacity: 0 with will-change: opacity shouldn't skip painting because the element will become non-zero opacity. |
... and should it have values that indicate priority
Presumably this would be an attribute on Element, meaning that any element would support this attribute. This would also be no-op for cases where rendering must be done anyway -- such as cases without content-visibility: hidden.
I don't want to call it anything like
asynchronous
because that gives an erroneous impression that if this element is visible, the updates to it are asynchronous. That may be something we do in the future for a different attribute, but this isn't it.I was thinking something like
keepUpdated
. Do folks have better suggestions?/cc @chrishtr
The text was updated successfully, but these errors were encountered: