Comments (7)
There's overlap here with the ideas in #1594.
The problem is that UAs throw the other declarations away when they see a new one in the same scope.
Ideally, we'd just not do that, and make it always possible to revert to the previous "winner" of the cascade (using a keyword). We'd need to investigate the performance implications of this, though.
from csswg-drafts.
That’s the idea for the opt-in: that authors would not be doing this for every single declaration, so the performance implications should be minimal.
from csswg-drafts.
#foo {
height: 1px;
block-size: 2px;
height: var(--invalid) !revertable;
}
Assuming an horizontal writing mode, should this revert to 2px or 1px? I guess 2px like revert-layer
would do in different layers, but it seems extra annoying for CSSOM.
I wonder if it would make more sense to add an entirely new rule like
@revertable #foo {
height: 1px;
block-size: 2px;
height: var(--invalid);
}
from csswg-drafts.
#foo { height: 1px; block-size: 2px; height: var(--invalid) !revertable; }Assuming an horizontal writing mode, should this revert to 2px or 1px? I guess 2px like
revert-layer
would do in different layers, but it seems extra annoying for CSSOM.I wonder if it would make more sense to add an entirely new rule like
@revertable #foo { height: 1px; block-size: 2px; height: var(--invalid); }
This seems orthogonal to the issue we’re discussing? It would revert to whatever this would revert to:
#foo { height: 1px; block-size: 2px; height: var(--invalid) !revertable; }
Not sure how UAs handle the aliasing, but that doesn't seem particularly difficult to define. They'd probably keep both around?
I wonder if it would make more sense to add an entirely new rule like
@revertable #foo { height: 1px; block-size: 2px; height: yolo; }
I would be strongly opposed to doing this as a rule. Rules are far more heavyweight, scoping has to be defined from scratch, and authors cannot port knowledge about it from other parts of CSS. @-rules should be a last resort, not the first thing we reach for because defining syntax with better ergonomics is harder.
from csswg-drafts.
Agenda+ since I had some discussions with implementers at the CSS WG meeting last week that indicated this is very implementable.
from csswg-drafts.
This seems orthogonal to the issue we’re discussing?
It isn't orthogonal. If we are only reverting to the same property, we could just shift down all declarations for the same property to the last one, then store the values together as a list, say that getPropertyValue
provides the last one, and add getPropertyValues
to get all of them. Similar for the setter and the priority. But we can at least keep the same indexing as now.
However, if we can revert to other properties, we can't keep assuming that a given property can only appear at most at one index. So it seems the API and the data structures used by browsers will need considerably bigger changes.
I would be strongly opposed to doing this as a rule.
Well, I would be strongly opposed to not exposing the necessary information via CSSOM.
And it doesn't seem great to pollute CSSStyleDeclaration
with several things that aren't needed by normal style rules.
from csswg-drafts.
Most aliases are known in advance. The only complication with the issue you're pointing out is that the aliasing can be dynamic. These cases are sufficiently few they can just be stored in a data structure (if they aren’t already).
Nothing is polluting CSSStyleDeclaration
, please read the first post more carefully?
But as a general principle, the ergonomics of the language itself are more important than CSS OM ergonomics. That doesn't mean the CSS OM doesn't matter, but the weightings of tradeoffs are different.
from csswg-drafts.
Related Issues (20)
- [css-values] Add `valid-empty`-like value (for CSS Custom Properties) HOT 15
- Feature Request: Collapsing Gaps for Grid Columns with auto or minmax(auto, 1fr) HOT 1
- [css-viewport] Move Visual Viewport (and more) from cssom-view to css-viewport
- [css-masking] Inverse clip-path HOT 3
- [css-overflow-4] display: -webkit-box and line-clamp without -webkit-box-orient: vertical HOT 1
- [cssom-view] Add scrollIntoView parameter to only scroll the nearest scrolling container HOT 2
- [css-fonts] Allow authors to redefine generic font families HOT 3
- [css-sticky] Can sticky left/right find nearest only scrolling-x ancestor?
- [css-anchor-position] `position-visibility: no-overflow` does not support Top Layers elements HOT 1
- [css-properties-values-api] Are fallbacks provided for registered properties validated by the CP syntax? HOT 2
- [css-masking] Formatting error in example 17 HOT 2
- [css-values-4][Editorial] `<condition>` type that other specs reference HOT 2
- [CSS3PAGE]: Page margin content should be able to display complex HTML content HOT 2
- [css-color-hdr] Where is the rec2100-pq/linear black luminance coming from? HOT 4
- [css-color-hdr] Absolute luminance of PQ HOT 9
- [css-ui] Pseudo-elements for stylable select HOT 2
- [css-viewport] interactive-widget=resizes-content - will that likely fix issues with fixed headers/footers and on-screen keyboards?
- [css-values-4][mediaqueries-4][mediaqueries-5] Duplicate definition of `<general-enclosed>` production
- Black about:blank page for dark themed OSes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csswg-drafts.