1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
|
<!doctype html>
<title>Column track merging</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src="/resources/check-layout-th.js"></script>
<link rel="author" title="Aleks Totic" href="atotic@chromium.org" />
<link rel="help" href="https://www.w3.org/TR/css-tables-3/#dimensioning-the-row-column-grid--step2" />
<style>
main table {
border: 10px solid gray;
border-spacing: 20px;
}
main td {
width: 50px;
height:50px;
padding: 0;
background:linear-gradient(to right, yellow, orange);
}
main caption {
background: #EEE;
}
main .desc {
margin-top: 20px;
color: rgb(50,0,0);
}
main pre {
white-space: pre-wrap;
}
</style>
<h3>Column merging investigation</h3>
<o>Empty columns is a column that has no originating cells</o>
<p><a href="https://www.w3.org/TR/css-tables-3/#dimensioning-the-row-column-grid--step2">Table standard</a> discusses this under "track merging".</p>
<ul>
<li>Do empty columns get coalesced?</li>
<li>How does this interact with table-layout:fixed, table width</li>
<li>Is there a difference between columns defined by COL, vs TD.colspan? Yes!</li>
<li>Do COLs with specified width get merged?</li>
</ul>
<p>Compatibility</p>
<li>Edge17 has a bug where width of a colspanned cell always includes cell width + width of border spacing. It should be max(cell width, border spacing)</li>
<li>Safari matches Chrome Legacy. TD-originated columns are always merged.</li>
<li>Firefox follows the standard, but has a few bugs.</li>
<main>
<h3>TD merging</h3>
<pre class="desc">Auto table, and TD.colspan=10
FF/Chrome Legacy/Safari: Standard. Tracks merge.
Edge17: Tracks do not merge. Wide cell is 180px (9 * border spacing)
</pre>
<table id="td_auto" data-expected-width=180>
<caption>auto</caption>
<tr>
<td colspan=10 data-expected-width=50></td>
<td></td>
</tr>
<tr>
<td colspan=10></td>
<td></td>
</tr>
</table>
<pre class="desc">Auto table(400px), and TD.colspan=10
FF/Chrome Legacy/Safari/Edge17: Standard. Tracks merge. Colspan cell grows because it is unconstrained.
</pre>
<table id="td_auto_width" style="width:400px" data-expected-width=400>
<caption>auto 400px</caption>
<tr>
<td colspan=10 data-expected-width=270></td>
<td></td>
</tr>
<tr>
<td colspan=10></td>
<td></td>
</tr>
</table>
<pre class="desc">Auto table(130px), and TD.colspan=10
FF/Chrome Legacy/Safari: Standard. Tracks merge. Colspan cell shrinks to min width becuase it is unconstrained.
Edge17: Non-compliant, buggy. Wide cell too wide, narrow cell disappears.
</pre>
<table id="td_auto_width_130" style="width:130px" data-expected-width=130>
<caption>auto 130px</caption>
<tr>
<td colspan=10 data-expected-width=10><div style="width:10px"></div></td>
<td></td>
</tr>
<tr>
<td colspan=10></td>
<td></td>
</tr>
</table>
<pre class="td_fixed">Fixed(400px) table, and TD.colspan=10
Chrome/Safari: Non-compliant. Tracks merge. Cells are the same size, fixed algo distributes extra width evenly.
Firefox: Standard.
Edge17: Standard, buggy. Wide cell too wide. Edge's bug is that it computes max width as (width + border_spacing) instead of max(width, border_spacing).
</pre>
<table id="td_fixed" style="table-layout:fixed; width: 400px" data-expected-width=400>
<caption>fixed 400px</caption>
<tr>
<td colspan=10 data-expected-width=180></td>
<td></td>
</tr>
<tr>
<td colspan=10></td>
<td></td>
</tr>
</table>
<pre class="td_fixed">Fixed(130px) table, and TD.colspan=10
Chrome/Safari: Non-compliant.Tracks merge, cells same size.
Firefox: Standard + buggy. Table does not grow.
Edge17: Standard + buggy. Wide cell too wide.
</pre>
<table id="td_fixed" style="table-layout:fixed; width: 130px" data-expected-width=310>
<caption>fixed 130px</caption>
<tr>
<td colspan=10 data-expected-width=180></td>
<td></td>
</tr>
<tr>
<td colspan=10></td>
<td></td>
</tr>
</table>
<h3>COL merging. Same tests with COL span=10 replacing TD</h3>
<pre class="desc">Auto table
FF/Chrome Legacy/Safari, Edge17: Standard. wide cell is 50px, tracks do merge.
</pre>
<table id="col_auto" data-expected-width=180>
<caption>auto</caption>
<col span=10>
<tr>
<td data-expected-width=50></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<pre class="desc">Auto table(400px)
FF/Chrome Legacy/Safari, Edge17: Standard. Both cells grow the same because unconstrained.
</pre>
<table id="col_auto_width" style="width:400px" data-expected-width=400>
<caption>auto 400px</caption>
<col span=10>
<tr>
<td data-expected-width=160></td>
<td></td>
</tr>
<tr>
<td ></td>
<td></td>
</tr>
</table>
<pre class="desc">Auto table(130px)
FF/Chrome Legacy/Safari, Edge17: Standard. Both cells shrink.
</pre>
<table id="col_auto_width_130" style="width:130px" data-expected-width=130>
<caption>auto 130px</caption>
<col span=10>
<tr>
<td data-expected-width=28><div style="width:10px"></div></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<pre class="desc">Fixed(400px) table
Chrome/Safari,Firefox: Standard.
Edge17: Buggy. Fixed cells grow to fill table.
</pre>
<table id="col_fixed" style="table-layout:fixed; width: 400px" data-expected-width=400>
<caption>fixed 400px</caption>
<col span=10>
<tr>
<td data-expected-width=50></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<pre class="td_fixed">Fixed(130px) table
Chrome/Safari: Standard, very buggy. Non-collapsed columns shrink to single border spacing.
Firefox: Standard.
Edge17: Non-compliant, collapses columns.
</pre>
<table id="col_fixed_130" style="table-layout:fixed; width: 130px" data-expected-width=340>
<col span=10>
<caption>fixed 130px</caption>
<tr>
<td data-expected-width=50></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<h3>COL merging when COL has specified width.</h3>
<ul><li>Chrome Legacy/Edge17/Safari: non-compliant, merge COLs with specified widths.
<li>Firefox: Standard, unless COL width is 0px. Buggy, does not include border-spacing around columns.</ul>
<pre class="desc">Auto table, COL width 30px.
Chrome Legacy/Edge17/Safari: non-compliant, merge.
Firefox: Standard, buggy. does not include border-spacing around columns.
</pre>
<table id="col_auto" data-expected-width=580>
<caption>auto col 30px</caption>
<col span=10 style="width:30px">
<tr>
<td data-expected-width=50></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<pre class="desc">Auto table, COL width 5%.
Chrome Legacy/Edge17/Safari: non-compliant, merge.
Firefox: Standard, buggy. does not include border-spacing around columns.
</pre>
<table id="col_auto" data-expected-width=640>
<caption>auto col 10%</caption>
<col span=5 style="width:10%">
<tr>
<td data-expected-width=100></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<pre class="desc">Auto table, COL width 0px.
Everyone: merges COL
</pre>
<table id="col_auto" data-expected-width=180>
<caption>auto col 0px</caption>
<col span=10 style="width:0px">
<tr>
<td data-expected-width=50></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</main>
<script>
checkLayout("main table");
</script>
</body>
</html>
|