break-{before,after}: column makes page-break-{before,after}'s computed style to serialize to auto instead of the empty string |
|||
Issue description
Chrome Version: (copy from chrome://version)
OS: (e.g. Win10, MacOS 10.12, etc...)
What steps will reproduce the problem?
<!doctype html>
<div style="break-after: column"></div>
<pre><script>
let div = document.querySelector("div");
document.writeln(`Specified: ${div.style.breakAfter}, ${div.style.pageBreakAfter}`);
document.writeln(`Computed: ${getComputedStyle(div).breakAfter}, ${getComputedStyle(div).pageBreakAfter}`);
</script></pre>
What is the expected result?
The second line reads "Computed: columns, "
What happens instead?
The second line reads "Computed: columns, auto"
break-after: column is not serializable as page-break-after, and thus it should be serialized as the empty string, not "auto".
,
Nov 18
,
Dec 3
,
Dec 3
Can someone point to the spec that says to serialize to the empty string? Why not the initial value?
,
Dec 3
The reasoning is that page-break-before is a shorthand of break-before, and when you specify longhands in a way that isn't representable by the shorthand, then the shorthand serializes to the empty string. A simple example of the same would be something like: document.body.style.font = "10px serif" document.body.style.fontStretch = "10%" document.body.style.font // Serializes "", not the initial "font" value or something like that.
,
Dec 3
Here's what I found: https://drafts.csswg.org/css-cascade-4/#legacy-shorthand https://www.w3.org/TR/cssom-1/#serializing-css-values "2. If shorthand cannot represent the values of list in its grammar, return the empty string and terminate these steps." Looks like Blink gets this right on a general basis (like your font test in #c5 ends up with the empty string). We don't implement the legacy page-* properties using the proposed shorthand mechanism, so that would be the explanation for that. I don't think this had been clarified in the spec back when this was implemented in Blink. See https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/properties/computed_style_utils.cc?l=2032&rcl=88f3200143459537d14a3ef2cb60a53f659ce815 |
|||
►
Sign in to add a comment |
|||
Comment 1 by emilio@chromium.org
, Nov 17Same happens with break-{before,after}: page and -webkit-column-break-before, as expected.