8000 [css-values-4] Define serialization of specified <position> #2274 · krushalnanda/csswg-drafts@0742ad6 · GitHub
Skip to content

Commit 0742ad6

Browse files
committed
[css-values-4] Define serialization of specified <position> w3c#2274
1 parent 3a115e9 commit 0742ad6

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

css-values-4/Overview.bs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,8 +2669,8 @@ Combination of <<image>></h4>
26692669
This has been disallowed generically because it creates parsing ambiguities
26702670
when combined with other length or percentage components in a property value.
26712671

2672-
The canonical order when serializing is
2673-
the horizontal component followed by the vertical component.
2672+
<h4 id="position-parsing">
2673+
Parsing <<position>></h4>
26742674

26752675
When specified in a grammar alongside other keywords, <<length>>s, or <<percentage>>s,
26762676
<<position>> is <em>greedily</em> parsed;
@@ -2689,6 +2689,33 @@ Combination of <<image>></h4>
26892689
followed by a <<length>>.
26902690
</div>
26912691

2692+
<h4 id="position-serialization">
2693+
Serializing <<position>></h4>
2694+
2695+
When serializing the [=specified value=] of a <<position>>:
2696+
2697+
<dl class=switch>
2698+
<dt>If only one component is specified:
2699+
<dd>
2700+
* The implied ''center'' keyword is added,
2701+
and a 2-component value is serialized.
2702+
2703+
<dt>If two components are specified:
2704+
<dd>
2705+
* Keywords are serialized as keywords.
2706+
* <<length-percentage>>s are serialized as <<length-percentage>>s.
2707+
* Components are serialized horizontal first, then vertical.
2708+
2709+
<dt>If four components are specified:
2710+
<dd>
2711+
* Keywords and offsets are both serialized.
2712+
* Components are serialized horizontal first, then vertical.
2713+
</dl>
2714+
2715+
Note: [=Computed values=] are always serialized as two offsets (without keywords)
2716+
because the [=computed value=] does not preserve syntactic distinctions.
2717+
2718+
26922719
<h4 id="combine-positions">
26932720
Combination of <<position>></h4>
26942721

0 commit comments

Comments
 (0)