compat
compat copied to clipboard
Difference between alias and mapping
Sorry to draw attention to such a small detail, but the difference between alias and mapping is not clear to me.
CSS Cascade defines that an alias is replaced by its target and both have the same syntax.
legacy name aliases: when the old property’s value syntax is identical to that of the new property, the two names are aliased with an operation on par with case-mapping: at parse time, the old property is converted into the new property. This conversion also applies in the CSSOM, both for string arguments and property accessors: requests for the old property name transparently transfer to the new property name instead.
The definition of property value aliases is similar, eg. -webkit-image-set()
is turned into image-set()
.
In contrast, browsers preserve mapped values:
style.cssText = '-webkit-align-items: center; -webkit-box-align: center; display: -webkit-box;'
style.cssText; // 'align-items: center; -webkit-box-align: center; display: -webkit-box;'
I think -webkit-device-pixel-ratio
, @-webkit-keyframes
, and -webkit-*-gradient()
are not aliases, but maps to the corresponding value (media feature name, rule, function).
EDIT
Sorry, both Chrome/Firefox handle -webkit-*-gradient()
and -webkit-device-pixel-ratio
as mapped values, but Chrome handles @-webkit-keyframes
as a mapped rule but Firefox handles it as an alias, which makes me think that the spec is clear but browsers are not always conformant.
Also confusing:
3.4.3. Non-aliased vendor prefixed properties
Note: This section used to specify the
-webkit-appearance
property. This is now defined in CSS Basic User Interface Module.
But in CSS UI
For compatibility with legacy content, UAs must also support
-webkit-appearance
as a legacy name alias ofappearance
.
https://drafts.csswg.org/css-ui/#propdef--webkit-appearance
About -webkit-appearance
I wonder if it's because of specs edit
- Jan 12, 2019 https://github.com/w3c/csswg-drafts/commit/207f67687aa94117155296a25beb2d7dfb09783e
- Oct 23, 2017 https://github.com/w3c/csswg-drafts/commit/f78b9c1b9a4531fbc3d0e7b9b969084958e49a45
The spec was saying https://github.com/w3c/csswg-drafts/commit/f78b9c1b9a4531fbc3d0e7b9b969084958e49a45#diff-cc2f666bf7d93dcefcc3fffc4761793a54fba00c03b53b9dbdf81f5056f0b56eR2242-R2243
Due to substantially different behavior, naïve aliasing of 'appearance' and of ''-webkit-appearance'' is unlikely to work.
So I guess the course has changed.
And probably, we should change this for -webkit-appearance
and move it to the aliased properties?
The previous edit in compatibility was done by @zcorpan https://github.com/whatwg/compat/commit/c497226c9988b0634cda9ba2c8d97ec4ccd93159
Do you agree with moving -webkit-appearance
to aliases?
https://compat.spec.whatwg.org/#css-simple-aliases
So I guess the course has changed.
You are right. Sorry, I did not searched more, if only for the note on the history of the feature, saying that this previously existed in prefixed form in most browsers. This note also says that each browser had its own syntax, so ~~I think it should be treated as a legacy shorthand.~~ EDIT: never mind, appearance
accepts all values that CSS UI or browsers defined with their own syntax, so it is fine to make it a simple alias.
As for the other confusing cases, I would be fine with closing this issue by defining the exact meaning of mapping. Specifically, I would like to know if the mapped value should appear in serialization.
The previous edit in compatibility was done by @zcorpan c497226
Do you agree with moving
-webkit-appearance
to aliases? https://compat.spec.whatwg.org/#css-simple-aliases
If we already have a definition of -webkit-appearance
in CSS UI, why also have it defined in Compat?
If we already have a definition of -webkit-appearance in CSS UI, why also have it defined in Compat?
Yeah, I also think that -webkit-apperance
should stay in CSS UI, and that the following change would have avoided my confusion on this.
- Note: This section used to specify the -webkit-appearance property. This is now defined in CSS Basic User Interface Module.
+ Note: This section used to specify the -webkit-appearance property. This is now defined in CSS Basic User Interface Module as an alias of `appearance`.
Seems like a useful addition.
If we already have a definition of -webkit-appearance in CSS UI, why also have it defined in Compat?
It's not defined in Compat spec. There's a placeholder redirecting to where it is defined. So people who are following historical links are properly redirected to the right place.
I'm OK with moving text around in the compat spec :)