Skip to content
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

[css-backgrounds-3] Computed values of background-repeat don't follow reality #1488

Closed
nox opened this issue Jun 1, 2017 · 5 comments
Closed

Comments

@nox
Copy link
Contributor

nox commented Jun 1, 2017

The spec says:

Computed value: A list, each item consisting of: two keywords, one per dimension

But Safari, Chrome and Firefox do otherwise and just serialise computed values as specified.

<div style="background-repeat: space"></div>
<pre>
<script>
    var div = document.getElementsByTagName("div")[0];
    document.write(div.style.backgroundRepeat, "<br>");
    document.write(getComputedStyle(div).backgroundRepeat);
</script>
@nox
Copy link
Contributor Author

nox commented Jun 1, 2017

Note also that if one runs that sample with space space, all three user agents I mentioned serialise the computed value as space, and Chrome is the only one to shorten the specified value from space space to space.

@tabatkins
Copy link
Member

"Computed value" and "serialization" are distinct, unrelated concepts. Computed value is a CSS-internal concept used by the specs.

The "shortest equivalent" rule is usually in effect for serializing computed values, which is why everyone serializes space space to space for computed values. Chrome is wrong to shorten the specified value; that should match what was input.

@nox
Copy link
Contributor Author

nox commented Jun 1, 2017

From what should I infer that when reading "A list, each item consisting of: two keywords, one per dimension" though? I don't understand why everyone should serialise to space when it says "two keywords" and nothing else, for computed values.

@tabatkins
Copy link
Member

Because, as I said, "computed value" and "serialization" have nothing directly to do with each other. The serialization of the value is not specified in the propdef table; it's implicitly specified in CSSOM as the shortest equivalent serialization that'll produce the same value.

The computed value is a pair of values. We can operate on that in spec text, asking what the horizontal background-repeat is, versus the vertical background-repeat. This avoids us having to go thru contortions in spec text to reproduce the effects of parsing, like "do X if the vertical repeat is Y, or if it's unspecified and the horizontal repeat is Y".

@nox
Copy link
Contributor Author

nox commented Jun 1, 2017

I see. Closing.

@nox nox closed this as completed Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants