Skip to content

Commit 3b69544

Browse files
committed
Remove all mention of 'mod' from calc(), because it doesn't make sense unless there's units on both sides.
1 parent 6961bf3 commit 3b69544

2 files changed

Lines changed: 14 additions & 23 deletions

File tree

css3-values/Overview.html

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,9 +1310,8 @@ <h3 id=calc><span class=secno>9.1. </span> Mathematical Expressions:
13101310
id=max>max()</dfn> functions allow mathematical expressions with addition
13111311
(&lsquo;<code class=css>+</code>&rsquo;), subtraction (&lsquo;<code
13121312
class=css>-</code>&rsquo;), multiplication (&lsquo;<code
1313-
class=css>*</code>&rsquo;), division (&lsquo;<code
1314-
class=css>/</code>&rsquo;), and modulus (&lsquo;<code
1315-
class=css>mod</code>&rsquo;) to be used as component values. The &lsquo;<a
1313+
class=css>*</code>&rsquo;), and division (&lsquo;<code
1314+
class=css>/</code>&rsquo;) to be used as component values. The &lsquo;<a
13161315
href="#calc0"><code class=css>calc()</code></a>&rsquo; expression
13171316
represents the result of the mathematical calculation it contains, using
13181317
standard precedence operator rules. The &lsquo;<a href="#min"><code
@@ -1324,11 +1323,7 @@ <h3 id=calc><span class=secno>9.1. </span> Mathematical Expressions:
13241323
href="#frequency-value"><code>&lt;frequency&gt;</code></a>, <a
13251324
href="#angle-value"><code>&lt;angle&gt;</code></a>, <a
13261325
href="#time-value"><code>&lt;time&gt;</code></a>, or <a
1327-
href="#number-value"><code>&lt;number&gt;</code></a> values are allowed.
1328-
1329-
<p class=issue>What definition of "mod" do we use? Should &lsquo;<code
1330-
class=css>calc(-3mod5)</code>&rsquo; return &lsquo;<code
1331-
class=css>-3</code>&rsquo; or &lsquo;<code class=css>2</code>&rsquo;?</p>
1326+
href="#number-value"><code>&lt;number&gt;</code></a> values are allowed.</p>
13321327
<!-- http://lists.w3.org/Archives/Public/www-style/2010May/0001.html
13331328
This has notes on how we should handle things when calc() is extended to
13341329
handle unit mult/div. Related to this is <unit>mod<unit>, which can return
@@ -1372,15 +1367,15 @@ <h3 id=calc><span class=secno>9.1. </span> Mathematical Expressions:
13721367
min : "min(" S* sum [ "," S* sum ]* S* ")";
13731368
max : "max(" S* sum [ "," S* sum ]* S* ")";
13741369
sum : product [ S+ [ "+" | "-" ] S+ product ]*;
1375-
product : unit [ S* [ "*" | "/" | "mod" ] S* unit ]*;
1370+
product : unit [ S* [ "*" | "/" ] S* unit ]*;
13761371
unit : ["+"|"-"]? [ NUMBER | DIMENSION | PERCENTAGE |
13771372
min | max | "(" S* sum S* ")" ];</pre>
13781373

13791374
<p class=note>Note that the grammar requires spaces around binary
13801375
&lsquo;<code class=css>+</code>&rsquo; and &lsquo;<code
13811376
class=css>-</code>&rsquo; operators. The &lsquo;<code
1382-
class=css>*</code>&rsquo;, &lsquo;<code class=css>/</code>&rsquo;, and
1383-
&lsquo;<code class=css>mod</code>&rsquo; operators do not require spaces.
1377+
class=css>*</code>&rsquo; and &lsquo;<code class=css>/</code>&rsquo;
1378+
operators do not require spaces.
13841379

13851380
<p>Additionally, the following redefinition is made to the informative
13861381
grammar appearing in <a href="http://www.w3.org/TR/CSS2/grammar.html">CSS
@@ -1432,10 +1427,9 @@ <h3 id=calc><span class=secno>9.1. </span> Mathematical Expressions:
14321427
side is &lsquo;<code class=css>&lt;number></code>&rsquo;; resolve to the
14331428
type of the other side
14341429

1435-
<li>At &lsquo;<code class=css>/</code>&rsquo; or &lsquo;<code
1436-
class=css>mod</code>&rsquo;, check that the right side is &lsquo;<code
1437-
class=css>&lt;number></code>&rsquo;; resolve to the type of the left
1438-
side.
1430+
<li>At &lsquo;<code class=css>/</code>&rsquo;, check that the right side
1431+
is &lsquo;<code class=css>&lt;number></code>&rsquo;; resolve to the type
1432+
of the left side.
14391433
</ul>
14401434

14411435
<p>If an operator does not pass the above checks, the expression is

css3-values/Overview.src.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -872,9 +872,9 @@ <h3 id="calc">
872872

873873
<p>The <dfn>calc()</dfn>, <dfn>min()</dfn>, and <dfn>max()</dfn> functions
874874
allow mathematical expressions with addition (''+''), subtraction (''-''),
875-
multiplication (''*''), division (''/''), and modulus (''mod'') to be used
875+
multiplication (''*''), and division (''/'') to be used
876876
as component values. The ''calc()'' expression represents the result of the
877-
mathematical calculation it contains, using standard precedence operator
877+
mathematical calculation it contains, using standard operator precedence
878878
rules. The ''min()'' and ''max()'' expressions represent the minimum and
879879
maximum, respectively, of their comma-separated arguments. These expressions
880880
can be used wherever
@@ -885,9 +885,6 @@ <h3 id="calc">
885885
<code>&lt;number&gt;</code>
886886
values are allowed.</p>
887887

888-
<p class='issue'>What definition of "mod" do we use? Should ''calc(-3mod5)''
889-
return ''-3'' or ''2''?</p>
890-
891888
<!-- http://lists.w3.org/Archives/Public/www-style/2010May/0001.html
892889
This has notes on how we should handle things when calc() is extended to
893890
handle unit mult/div. Related to this is <unit>mod<unit>, which can return
@@ -932,12 +929,12 @@ <h3 id="calc">
932929
min : "min(" S* sum [ "," S* sum ]* S* ")";
933930
max : "max(" S* sum [ "," S* sum ]* S* ")";
934931
sum : product [ S+ [ "+" | "-" ] S+ product ]*;
935-
product : unit [ S* [ "*" | "/" | "mod" ] S* unit ]*;
932+
product : unit [ S* [ "*" | "/" ] S* unit ]*;
936933
unit : ["+"|"-"]? [ NUMBER | DIMENSION | PERCENTAGE |
937934
min | max | "(" S* sum S* ")" ];</pre>
938935

939936
<p class='note'>Note that the grammar requires spaces around binary ''+''
940-
and ''-'' operators. The ''*'', ''/'', and ''mod'' operators do not require
937+
and ''-'' operators. The ''*'' and ''/'' operators do not require
941938
spaces.</p>
942939

943940
<p>Additionally, the following redefinition is made to the informative
@@ -979,7 +976,7 @@ <h3 id="calc">
979976
<li>At ''*'', check that at least one side is ''&lt;number>'';
980977
resolve to the type of the other side</li>
981978

982-
<li>At ''/'' or ''mod'', check that the right side is ''&lt;number>'';
979+
<li>At ''/'', check that the right side is ''&lt;number>'';
983980
resolve to the type of the left side.</li>
984981
</ul>
985982

0 commit comments

Comments
 (0)