Skip to content

[cssom-1] Serialization of feature values #11041

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 Oct 16, 2024 · 4 comments
Open

[cssom-1] Serialization of feature values #11041

cdoublev opened this issue Oct 16, 2024 · 4 comments
Labels
cssom-1 Current Work

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Oct 16, 2024

Serializing Media Feature Values is poorly defined.

This is not really important but hey, it could simply be replaced with serializing a CSS component value: keywords in lowercase, base 10 numbers, etc.

In current version of Chrome and FF:

Input Chrome FF Expected
orientation: PORTRAIT orientation: portrait orientation: portrait orientation: portrait
aspect-ratio: 1 aspect-ratio: 1 / 1 aspect-ratio: 1 / 1 aspect-ratio: 1 / 1
width: 0 width: 0 width: 0px width: 0px
width: 1.0px width: 1px width: 1px width: 1px
width: calc(1px * 2) width: calc(2px) width: calc(2px) width: calc(2px)
@cdoublev cdoublev added the cssom-1 Current Work label Oct 16, 2024
@Loirooriol
Copy link
Contributor

Lengths don't seem to serialize with the canonical unit at declaration-value time:

var div = document.createElement("div");
div.style.width = "1in";
div.style.width; // "1in"

Also the value of the color feature should apparently be an <integer>, so 1.0 in invalid, and see #10238 for 1e1.

@cdoublev
Copy link
Collaborator Author

Thanks, I replaced color: 1.0 with width: 1.0px and removed the row with color: 1e1.

However, CSSOM wants dimensions to serialize with the "<number> [component] followed by the unit in its canonical form".

@Loirooriol
Copy link
Contributor

It says

Probably should distinguish between declared and computed / resolved values.

@cdoublev
Copy link
Collaborator Author

cdoublev commented Oct 17, 2024

Right, and "the unit in its canonical form" does not necessarily mean "the dimension in its canonical unit". I removed the row (thanks again).

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

No branches or pull requests

2 participants