Skip to content

Commit 4fbd00f

Browse files
aygzcorpan
authored andcommitted
Standardize special behavior of colspan/rowspan
Fixes whatwg#1198. Browsers all behave differently here, the spec matches none. The basic behavior selected was that of Chrome, except for very high values where we don't spec its overflow behavior. The colspan limit of 1000 matches Firefox/Edge (Firefox is not willing to raise its limit), instead of higher limits of 8190 in Chrome or more in WebKit. The rowspan limit of 65534 matches Firefox and Chrome, as opposed to 65535 in Edge or 8190 in WebKit. For setting, I followed Firefox because it's the simplest. Chrome converts negative numbers to 0, and Edge throws in some cases and clamps in others. Tests: whatwg#1993
1 parent 2ff8134 commit 4fbd00f

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

source

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6989,6 +6989,16 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
69896989
the number as a <span>valid non-negative integer</span> and that string must be used as the new
69906990
content attribute value.</p> <!-- see previous paragraph for note about the weird range -->
69916991

6992+
<p>If a reflecting IDL attribute has an unsigned integer type (<code
6993+
data-x="idl-unsigned-long">unsigned long</code>) that is <dfn>clamped to the range</dfn>
6994+
[<var>min</var>, <var>max</var>], then on getting, the content attribute must first be parsed
6995+
according to the <span>rules for parsing non-negative integers</span>, and if that is successful,
6996+
and the value is between <var>min</var> and <var>max</var> inclusive, the resulting value must be
6997+
returned. If it fails, the default value must be returned. If it succeeds but the value is less
6998+
than <var>min</var>, <var>min</var> must be returned. If it succeeds but the value is greater than
6999+
<var>max</var>, <var>max</var> must be returned. On setting, it behaves the same as setting a
7000+
regular reflected unsigned integer.</p>
7001+
69927002
<p>If a reflecting IDL attribute has a floating-point number type (<code
69937003
data-x="idl-double">double</code> or <code data-x="idl-unrestricted-double">unrestricted
69947004
double</code>), then, on getting, the content attribute must be parsed according to the
@@ -40217,10 +40227,11 @@ interface <dfn>HTMLTableCellElement</dfn> : <span>HTMLElement</span> {
4021740227
<h4>Attributes common to <code>td</code> and <code>th</code> elements</h4>
4021840228

4021940229
<p>The <code>td</code> and <code>th</code> elements may have a <dfn><code data-x="attr-tdth-colspan">colspan</code></dfn> content attribute specified, whose value must
40220-
be a <span>valid non-negative integer</span> greater than zero.</p>
40230+
be a <span>valid non-negative integer</span> greater than zero and less than or equal to 1000.</p>
4022140231

4022240232
<p>The <code>td</code> and <code>th</code> elements may also have a <dfn><code data-x="attr-tdth-rowspan">rowspan</code></dfn> content attribute specified, whose value must
40223-
be a <span>valid non-negative integer</span>. For this attribute, the value zero means that the
40233+
be a <span>valid non-negative integer</span> less than or equal to 65534.
40234+
For this attribute, the value zero means that the
4022440235
cell is to span all the remaining rows in the row group.</p> <!-- only in no-quirks and
4022540236
limited-quirks mode though, for back compat! -->
4022640237

@@ -40279,18 +40290,20 @@ interface <dfn>HTMLTableCellElement</dfn> : <span>HTMLElement</span> {
4027940290

4028040291
<div w-nodev>
4028140292

40282-
<p>The <dfn><code data-x="dom-tdth-colSpan">colSpan</code></dfn> IDL attribute must
40283-
<span>reflect</span> the <code data-x="attr-tdth-colspan">colspan</code> content attribute. Its
40284-
default value is 1.</p>
40285-
4028640293
<!--
4028740294
https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=1699
4028840295
https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=1700
4028940296
-->
4029040297

40298+
<!-- For colSpan/rowSpan rationale: https://github.com/whatwg/html/issues/1198 -->
40299+
40300+
<p>The <dfn><code data-x="dom-tdth-colSpan">colSpan</code></dfn> IDL attribute must
40301+
<span>reflect</span> the <code data-x="attr-tdth-colspan">colspan</code> content attribute. It is
40302+
<span>clamped to the range</span> [1, 1000], and its default value is 1.</p>
40303+
4029140304
<p>The <dfn><code data-x="dom-tdth-rowSpan">rowSpan</code></dfn> IDL attribute must
40292-
<span>reflect</span> the <code data-x="attr-tdth-rowspan">rowspan</code> content attribute. Its
40293-
default value is 1.</p>
40305+
<span>reflect</span> the <code data-x="attr-tdth-rowspan">rowspan</code> content attribute. It is
40306+
<span>clamped to the range</span> [0, 65534], and its default value is 1.</p>
4029440307

4029540308
<p>The <dfn><code data-x="dom-tdth-headers">headers</code></dfn> IDL attribute must
4029640309
<span>reflect</span> the content attribute of the same name.</p>
@@ -40847,6 +40860,8 @@ interface <dfn>HTMLTableCellElement</dfn> : <span>HTMLElement</span> {
4084740860

4084840861
<p>If parsing that value failed, or returned zero, or if the attribute is absent, then let <var>colspan</var> be 1, instead.</p>
4084940862

40863+
<p>If <var>colspan</var> is greater than 1000, let it be 1000 instead.</p>
40864+
4085040865
</li>
4085140866

4085240867
<li>
@@ -40857,6 +40872,8 @@ interface <dfn>HTMLTableCellElement</dfn> : <span>HTMLElement</span> {
4085740872

4085840873
<p>If parsing that value failed or if the attribute is absent, then let <var>rowspan</var> be 1, instead.</p>
4085940874

40875+
<p>If <var>rowspan</var> is greater than 65534, let it be 65534 instead.</p>
40876+
4086040877
</li>
4086140878

4086240879
<li>

0 commit comments

Comments
 (0)