Skip to content

[css-cascade][css-transition] Should property aliasing/mapping applies to transition[-property]? #8022

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

Open
cdoublev opened this issue Nov 5, 2022 · 5 comments
Labels
css-transitions-1 Current Work

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Nov 5, 2022

I would like to know in which cases a property name should be replaced in the parsing/serialization of transition-property. It does not seem clearly defined in CSS Cascade.

style.transitionProperty = `
  word-wrap,                /* Unprefixed legacy name alias */
  grid-row-gap,             /* Unprefixed legacy shorthand */
  page-break-before,        /* Unprefixed legacy shorthand */
  -webkit-background-size,  /* Legacy name alias */
  -webkit-box-ordinal-group /* Legacy mapping property */
`
style.cssText;

The output in Chrome for style.cssText is transition-property: word-wrap, grid-row-gap, page-break-before, -webkit-background-size, -webkit-box-ordinal-group;.

The output in Firefox is transition-property: overflow-wrap, row-gap, page-break-before, background-size, -moz-box-ordinal-group;.

@Loirooriol
Copy link
Contributor

transition-property just accepts a list of custom idents that may not be properties at all, so applying the mapping seems weird to me.
Just like specifying a shorthand will make the longhands be transitioned without expanding the shorthand in the value, specifying an alias could make the aliased property be transitioned without changing the value.

@Loirooriol Loirooriol added the css-transitions-1 Current Work label Nov 5, 2022
@cdoublev
Copy link
Collaborator Author

cdoublev commented Nov 5, 2022

Simple aliases are discussed in #866.

For the alias part, it isn't clear to me that the spec text defines what's supposed to happen in APIs that return the name of the property, such as getting the value of the transition-property property.

Hm, indeed. We should make that clear.

It is clear. The spec says

When the old property’s syntax is identical to or a subset of the value space of the new property’s syntax, the two names are aliased with an operation on par with case-mapping.

@Loirooriol
Copy link
Contributor

Well, I don't see https://drafts.csswg.org/css-transitions-1/#transition-property-property saying that idents should be normalized to lowercase (this should probably be filed as another issue). In fact it doesn't seem much consistent:

document.body.style.transitionProperty = "lOreMipsUm, cOloR";
document.body.style.transitionProperty; // Implementations say "lOreMipsUm, color"

Note that https://drafts.csswg.org/css-values-4/#identifier-value says

Such identifiers are fully case-sensitive

And even if transition-property interprets custom keywords case-insensitively, I still don't think think transition-property: word-wrap becoming transition-property: overflow-wrap follows from the text in CSS Cascade.

Otherwise, imagine we add a property foo with grammar bar | word-wrap. Should foo: word-wrap become foo: overflow-wrap just because foo: BaR becomes foo: bar? I don't think so.

@cdoublev
Copy link
Collaborator Author

cdoublev commented Nov 6, 2022

I agree. I also do not think a legacy property name should be replaced in a feature query.

@Loirooriol
Copy link
Contributor

Same question for will-change:

document.body.style.willChange = "word-wrap";
document.body.style.willChange;

Firefox and Blink: "word-wrap"
WebKit: "overflow-wrap"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-transitions-1 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants