Skip to content

Commit 4531ae4

Browse files
committed
Merge branch '18F-multiple-row-spans'
2 parents b141b59 + f1eaccf commit 4531ae4

2 files changed

Lines changed: 74 additions & 4 deletions

File tree

HTMLCS.Util.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,7 @@ _global.HTMLCS.util = function() {
11111111
if (thisCell.nodeType === 1) {
11121112
// Skip columns that are skipped due to rowspan.
11131113
if (skipCells[rownum]) {
1114-
while (skipCells[rownum][0] === colnum) {
1115-
skipCells[rownum].shift();
1114+
while (skipCells[rownum][colnum]) {
11161115
colnum++;
11171116
}
11181117
}
@@ -1130,7 +1129,7 @@ _global.HTMLCS.util = function() {
11301129
}
11311130

11321131
for (var j = colnum; j < colnum + colspan; j++) {
1133-
skipCells[i].push(j);
1132+
skipCells[i][j] = true;
11341133
}
11351134
}
11361135
}
@@ -1171,7 +1170,11 @@ _global.HTMLCS.util = function() {
11711170
}//end for
11721171

11731172
if (exp.length > 0) {
1174-
exp = ' ' + exp.sort().join(' ') + ' ';
1173+
// Sort and filter expected ids by unique value.
1174+
var filteredExp = exp.sort().filter(function(value, index, self) {
1175+
return self.indexOf(value) === index;
1176+
});
1177+
exp = ' ' + filteredExp.join(' ') + ' ';
11751178
exp = exp.replace(/\s+/g, ' ').replace(/(\w+\s)\1+/g, '$1').replace(/^\s*(.*?)\s*$/g, '$1');
11761179
cells.push({
11771180
cell: thisCell,

Tests/WCAG2/1_3_1_Table_Header_Attr.html

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
Name: SC 1.3.1 Table Heading Attributes
77
Standard: WCAG2AAA
88
Assert: No Error *.H43.IncorrectAttr on #correctTableHeaders
9+
Assert: No Error *.H43.IncorrectAttr on #correctTableHeadersComplexRowspan
10+
Assert: No Error *.H43.ScopeAmbiguous on #correctTableHeadersComplexRowspan
11+
Assert: No Error *.H43.HeadersRequired on #correctTableHeadersComplexRowspan
12+
Assert: No Error *.H43.MissingHeaderIds on #correctTableHeadersComplexRowspan
13+
Assert: No Error *.H43.MissingHeadersAttrs on #correctTableHeadersComplexRowspan
14+
Assert: No Error *.H63.1 on #correctTableHeadersComplexRowspan
15+
Assert: No Error *.H43,H63 on #correctTableHeadersComplexRowspan
916
-->
1017
</head>
1118
<body>
@@ -41,5 +48,65 @@
4148
</td>
4249
</tr>
4350
</table>
51+
52+
<table id="correctTableHeadersComplexRowspan">
53+
<thead>
54+
<tr>
55+
<th rowspan="2" id="h1-0"></th>
56+
<th colspan="5" id="h1-1-5">long header</th>
57+
<th rowspan="2" id="h1-6">last header</th>
58+
</tr>
59+
<tr>
60+
<th id="h2-1">sub1</th>
61+
<th id="h2-2">sub2</th>
62+
<th id="h2-3">sub3</th>
63+
<th id="h2-4">sub4</th>
64+
<th id="h2-5">sub5</th>
65+
</tr>
66+
</thead>
67+
<tbody>
68+
<tr>
69+
<td rowspan="2" headers="h1-0">1.0</td>
70+
<td headers="h1-1-5 h2-1">1.1.1</td>
71+
<td headers="h1-1-5 h2-2">1.2.1</td>
72+
<td headers="h1-1-5 h2-3">1.3.1</td>
73+
<td headers="h1-1-5 h2-4">1.4.1</td>
74+
<td headers="h1-1-5 h2-5">1.5.1</td>
75+
<td rowspan="2" headers="h1-6">1.6</td>
76+
</tr>
77+
<tr>
78+
<td headers="h1-1-5 h2-1">1.1.2</td>
79+
<td headers="h1-1-5 h2-2">1.2.2</td>
80+
<td headers="h1-1-5 h2-3">1.3.2</td>
81+
<td headers="h1-1-5 h2-4">1.4.2</td>
82+
<td headers="h1-1-5 h2-5">1.5.2</td>
83+
</tr>
84+
<tr>
85+
<td rowspan="2" headers="h1-0">2.0</td>
86+
<td headers="h1-1-5 h2-1">2.1.1</td>
87+
<td headers="h1-1-5 h2-2">2.2.1</td>
88+
<td headers="h1-1-5 h2-3">2.3.1</td>
89+
<td headers="h1-1-5 h2-4">2.4.1</td>
90+
<td headers="h1-1-5 h2-5">2.5.1</td>
91+
<td rowspan="2" headers="h1-6">2.6</td>
92+
</tr>
93+
<tr>
94+
<td headers="h1-1-5 h2-1">2.1.2</td>
95+
<td headers="h1-1-5 h2-2">2.2.2</td>
96+
<td headers="h1-1-5 h2-3">2.3.2</td>
97+
<td headers="h1-1-5 h2-4">2.4.2</td>
98+
<td headers="h1-1-5 h2-5">2.5.2</td>
99+
</tr>
100+
<tr>
101+
<td rowspan="2" headers="h1-0">3.0</td>
102+
<td headers="h1-1-5 h2-1">3.1</td>
103+
<td headers="h1-1-5 h2-2">3.2</td>
104+
<td headers="h1-1-5 h2-3">3.3</td>
105+
<td headers="h1-1-5 h2-4">3.4</td>
106+
<td headers="h1-1-5 h2-5">3.5</td>
107+
<td rowspan="2" headers="h1-6">3.6</td>
108+
</tr>
109+
</tbody>
110+
</table>
44111
</body>
45112
</html>

0 commit comments

Comments
 (0)