Skip to content

Commit

Permalink
[css-values-4] Define serialization of specified <position> #2274
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasai committed Oct 11, 2022
1 parent 3a115e9 commit 0742ad6
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions css-values-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2669,8 +2669,8 @@ Combination of <<image>></h4>
This has been disallowed generically because it creates parsing ambiguities
when combined with other length or percentage components in a property value.

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

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

<h4 id="position-serialization">
Serializing <<position>></h4>

When serializing the [=specified value=] of a <<position>>:

<dl class=switch>
<dt>If only one component is specified:
<dd>
* The implied ''center'' keyword is added,
and a 2-component value is serialized.

<dt>If two components are specified:
<dd>
* Keywords are serialized as keywords.
* <<length-percentage>>s are serialized as <<length-percentage>>s.
* Components are serialized horizontal first, then vertical.

<dt>If four components are specified:
<dd>
* Keywords and offsets are both serialized.
* Components are serialized horizontal first, then vertical.
</dl>

Note: [=Computed values=] are always serialized as two offsets (without keywords)
because the [=computed value=] does not preserve syntactic distinctions.


<h4 id="combine-positions">
Combination of <<position>></h4>

Expand Down

0 comments on commit 0742ad6

Please sign in to comment.