layout/reftests/bugs/290129-1.html

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 <html>
michael@0 2 <head>
michael@0 3 <style>
michael@0 4 th, td { background: #ddd; }
michael@0 5 table { border-collapse: collapse; }
michael@0 6 </style>
michael@0 7 </head>
michael@0 8 <body>
michael@0 9
michael@0 10 <table border="1">
michael@0 11 <tr><th>x</th><th colspan="2" class="a1 a2">A</th></tr>
michael@0 12 <tr><th>x</th><td class="a1">a1</td><td class="a2">a2</td></tr>
michael@0 13 </table>
michael@0 14
michael@0 15 <script type="text/javascript">
michael@0 16
michael@0 17 function addCSSRule(selector, rule) {
michael@0 18 var css = document.styleSheets[ document.styleSheets.length -1];
michael@0 19 css.insertRule(selector+" {"+rule+"}", css.cssRules.length);
michael@0 20 }
michael@0 21
michael@0 22 function removeCSSRule(selector, rule) {
michael@0 23 rule = rule.split(':');
michael@0 24 for (cssno=0; cssno<document.styleSheets.length;cssno++) {
michael@0 25 var css = document.styleSheets[cssno];
michael@0 26 for (i=(css.cssRules.length-1);i>=0;i--) {
michael@0 27 var rule = css.cssRules[i];
michael@0 28 if (rule.selectorText == selector && rule.style[ rule[0] ] == rule[1])
michael@0 29 css.deleteRule(i);
michael@0 30 }
michael@0 31 }
michael@0 32 }
michael@0 33
michael@0 34 function setClassDisplay(display, classname) {
michael@0 35 document.body.offsetWidth
michael@0 36 if (display)
michael@0 37 removeCSSRule("."+classname, "display:none");
michael@0 38 else
michael@0 39 addCSSRule("."+classname, "display:none");
michael@0 40 }
michael@0 41
michael@0 42 setClassDisplay(false, 'a1');
michael@0 43 setClassDisplay(false, 'a2');
michael@0 44 setClassDisplay(true, 'a1');
michael@0 45 setClassDisplay(true, 'a2');
michael@0 46 </script>
michael@0 47
michael@0 48 </body>
michael@0 49 </html>

mercurial