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
|
<!doctype html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<link rel='stylesheet' href='./support/base.css' />
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#mapping">
<main>
<h1>HTML-2-CSS Mapping</h1>
<p>Checks that browsers implement properly the html2css stylesheet (rules about borders, disabling border-collapse for clarity)</p>
<style>table { border-collapse: separate !important; }</style>
<hr/>
<p>1: The border of the table element should be 0px hidden gray:</p>
<p>
<code>border-width:0px</code> is the <code>initial</code> value;<br/>
<code>border-style:hidden</code> comes from <code>table:matches(..., [rules=groups], ...)</code>;<br/>
<code>border-color:gray</code> comes from <code>table</code>
</p>
<div><table border="0" rules="groups"><tbody><tr><td></td></tr></tbody></table></div>
<hr/>
<p>2: The border of the table element should be 1px outset black:</p>
<p>
<code>border-width:1px</code> comes from <code>table[frame=box] (1/2)</code>;<br/>
<code>border-style:outset</code> comes from <code>table[frame=box] (2/2)</code>;<br/>
<code>border-color:black</code> comes from <code>table:matches(..., [rules=groups], ...)</code>
</p>
<div><table border="0" rules="groups" frame="box"><tbody><tr><td></td></tr></tbody></table></div>
<hr/>
<p>3a: The border of the table element should be 10px outset gray:</p>
<p>
<code>border-width:10px</code> comes from <code>table[border=$w]</code>;<br/>
<code>border-style:outset</code> comes from <code>table[frame=box] (2/2)</code>;<br/>
<code>border-color:gray</code> comes from <code>table[border=$w]</code>
</p>
<hr style="display:none"/>
<p>3b: The border-top of the td element should be 1px inset gray:</p>
<p>
<code>border-width:1px</code> comes from <code>table[border=$w] > ...td</code>;<br/>
<code>border-style:inset</code> comes from <code>table[border=$w] > ...td</code>;<br/>
<code>border-color:gray</code> comes from <code>table[border=$w] > ...td</code>
</p>
<hr style="display:none"/>
<p>3c: The border-left of the td element should be 1px hidden gray:</p>
<p>
<code>border-width:1px</code> comes from <code>table[border=$w] > ...td</code>;<br/>
<code>border-style:inset</code> comes from <code>table[border=$w] > ...td</code>;<br/>
<code>border-color:gray</code> comes from <code>table[border=$w] > ...td</code>
</p>
<div><table border="10" rules="groups" frame="box"><tbody><tr><td></td></tr></tbody></table></div>
<hr/>
<p>4a: The border of the table element should be 1px outset gray:</p>
<p>
<code>border-width:10px</code> comes from <code>table[border=$w]</code>;<br/>
<code>border-style:outset</code> comes from <code>table[border=$w]</code>;<br/>
<code>border-color:gray</code> comes from <code>table[border=$w]</code>
</p>
<hr style="display:none">
<p>4b: The top border of the td element should be 1px solid gray:</p>
<p>
<code>border-width:1px</code> comes from <code>table[rules=all] > ... td</code>;<br/>
<code>border-style:solid</code> comes from <code>table[rules=all] > ... td</code>;<br/>
<code>border-color:gray</code> comes from <code>table[rules=all] > ... td</code>
</p>
<div><table border="yes" rules="all"><tr><td></td></tr></table></div>
<hr>
<p>5a: The left border of the table element should be ? hidden ?:</p>
<p>
<code>border-style:hidden</code> comes from <code>table[frame=hsides]</code>;<br/>
</p>
<hr style="display:none">
<p>5b: The right border of the table element should be 10px solid gray:</p>
<p>
<code>border-width:10px</code> comes from <code>table[border=$w]</code>;<br/>
<code>border-style:solid</code> comes from <code>[style]</code>;<br/>
<code>border-color:gray</code> comes from <code>table[border=$w]</code>
</p>
<div><table border="10" frame="hsides" style="border-right-style: solid"><tr><td></td></tr></table></div>
<script>void function() { var table; while(table = document.querySelector('.to-remove')) table.parentNode.replaceChild(table.firstChild,table) }();</script>
<script>void function() { var td; while(td = document.querySelector('table.no-td td')) td.parentNode.replaceChild(document.createElement('x-td'),td) }();</script>
<script>void function() { var divs = document.querySelectorAll("main > div"); for(var i = divs.length; i--;) { var div = divs[i]; var pre = document.createElement('pre'); pre.title = pre.textContent = div.innerHTML; div.parentNode.insertBefore(pre, div); }; }();</script>
<hr/>
</main>
<script>
var i = 1;
generate_tests(assert_equals, [
/*========================================*/
[
"1: HTML -> CSS Mapping for borders is applied correctly on table markup (table left width)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i++)+") table")).borderLeftWidth,
"0px"
],
[
"1: HTML -> CSS Mapping for borders is applied correctly on table markup (table left style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderLeftStyle,
"hidden"
],
[
"1: HTML -> CSS Mapping for borders is applied correctly on table markup (table left color)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderLeftColor,
"rgb(128, 128, 128)"
],
/*========================================*/
[
"2: HTML -> CSS Mapping for borders is applied correctly on table markup (table left width)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i++)+") table")).borderLeftWidth,
"1px"
],
[
"2: HTML -> CSS Mapping for borders is applied correctly on table markup (table left style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderLeftStyle,
"outset"
],
[
"2: HTML -> CSS Mapping for borders is applied correctly on table markup (table left color)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderLeftColor,
"rgb(0, 0, 0)"
],
/*========================================*/
[
"3a: HTML -> CSS Mapping for borders is applied correctly on table markup (table left width)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i++)+") table")).borderLeftWidth,
"10px"
],
[
"3a: HTML -> CSS Mapping for borders is applied correctly on table markup (table left style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderLeftStyle,
"outset"
],
[
"3a: HTML -> CSS Mapping for borders is applied correctly on table markup (table left color)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderLeftColor,
"rgb(128, 128, 128)"
],
[
"3b: HTML -> CSS Mapping for borders is applied correctly on table markup (td top width)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderTopWidth,
"1px"
],
[
"3b: HTML -> CSS Mapping for borders is applied correctly on table markup (td top style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderTopStyle,
"inset"
],
[
"3b: HTML -> CSS Mapping for borders is applied correctly on table markup (td top color)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderTopColor,
"rgb(128, 128, 128)"
],
[
"3c: HTML -> CSS Mapping for borders is applied correctly on table markup (td left width)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderLeftWidth,
"1px"
],
[
"3c: HTML -> CSS Mapping for borders is applied correctly on table markup (td left style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderLeftStyle,
"inset"
],
[
"3c: HTML -> CSS Mapping for borders is applied correctly on table markup (td left color)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderLeftColor,
"rgb(128, 128, 128)"
],
/*========================================*/
[
"4: HTML -> CSS Mapping for borders is applied correctly on table markup (table left width)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i++)+") table")).borderLeftWidth,
"1px"
],
[
"4: HTML -> CSS Mapping for borders is applied correctly on table markup (table left style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderLeftStyle,
"outset"
],
[
"4: HTML -> CSS Mapping for borders is applied correctly on table markup (table left color)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderLeftColor,
"rgb(128, 128, 128)"
],
[
"4: HTML -> CSS Mapping for borders is applied correctly on table markup (td left width)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderLeftWidth,
"1px"
],
[
"4: HTML -> CSS Mapping for borders is applied correctly on table markup (td left style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderLeftStyle,
"solid"
],
[
"4: HTML -> CSS Mapping for borders is applied correctly on table markup (td left color)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table td")).borderLeftColor,
"rgb(128, 128, 128)"
],
/*========================================*/
[
"5a: HTML -> CSS Mapping for borders is applied correctly on table markup (table left style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i++)+") table")).borderLeftStyle,
"hidden"
],
[
"5b: HTML -> CSS Mapping for borders is applied correctly on table markup (table right width)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderRightWidth,
"10px"
],
[
"5b: HTML -> CSS Mapping for borders is applied correctly on table markup (table right style)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderRightStyle,
"solid"
],
[
"5b: HTML -> CSS Mapping for borders is applied correctly on table markup (table right color)",
getComputedStyle(document.querySelector("main > div:nth-of-type("+(i-1)+") table")).borderRightColor,
"rgb(128, 128, 128)"
],
])
</script>
|