Skip to content

Commit 1511ec2

Browse files
committed
[css-values-4] Define how to serialize a math function that's infinite or NaN. Fixes #3768.
1 parent 6171c00 commit 1511ec2

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

css-values-4/Overview.bs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,12 +3594,25 @@ Serialization</h3>
35943594
then serialize the value as normal
35953595
and return the result.
35963596

3597-
2. Let |s| be a [=string=] that initially contains
3597+
2. If |fn| represents an infinite or NaN value:
3598+
1. Let |s| be the [=string=] "calc(".
3599+
2. Create a numeric value
3600+
in the [=canonical unit=] for |fn|'s [=CSSNumericValue/type=]
3601+
(such as ''px'' for <<length>>),
3602+
with a value of 1 if |fn| represents +∞,
3603+
a value of -1 if |fn| represents −∞,
3604+
or a value of 0 if |fn| represents NaN.
3605+
Serialize this numeric value
3606+
and append it to |s|.
3607+
3. Append " / 0)" to |s|,
3608+
and return |s|.
3609+
3610+
3. Let |s| be a [=string=] that initially contains
35983611
the |fn|'s name
35993612
(such as "calc", "sin", etc)
36003613
followed by a "(" (open parenthesis).
36013614

3602-
3. For each comma-separated [=calculation=] argument of |fn|,
3615+
4. For each comma-separated [=calculation=] argument of |fn|,
36033616
[=serialize the calculation tree=].
36043617
If a result of this starts with a "(" (open parenthesis)
36053618
and ends with a ")" (close parenthesis),
@@ -3608,9 +3621,9 @@ Serialization</h3>
36083621
using ", " (comma followed by space),
36093622
then append the result to |s|.
36103623

3611-
4. Append ")" (close parenthesis) to |s|.
3624+
5. Append ")" (close parenthesis) to |s|.
36123625

3613-
5. Return |s|.
3626+
6. Return |s|.
36143627
</div>
36153628

36163629
<div algorithm>

0 commit comments

Comments
 (0)