4 <style type=
"text/css">
9 border: 1px solid
#ccc;
11 vertical-align: middle
;
14 <script src=
"../../resources/js-test.js"></script>
19 <td id=
"elementWithoutStyleAttribute">no HTML style attribute, no get/setAttribute
</td>
20 <td id=
"elementWithEmptyStyleAttribute" style=
"">empty HTML style attribute, no get/setAttribute
</td>
21 <td id=
"elementWithStyleAttribute" style=
"opacity: 1;">non-empty HTML style attribute, no get/setAttribute
</td>
24 <td id=
"elementWithoutStyleAttribute2">no HTML style attribute, getAttribute before modifying IDL attribute
</td>
25 <td id=
"elementWithoutStyleAttribute3">no HTML style attribute, getAttribute after modifying IDL attribute
</td>
26 <td id=
"elementWithoutStyleAttribute4">no HTML style attribute, setAttribute before removeAttribute
</td>
29 <div id=
"console"></div>
31 description("[bug 99295] removeAttribute('style') not working in certain circumstances. If this test passes, all backgroundColors are rgba(0, 0, 0, 0), i.e. all styles are removed.");
33 var elementWithoutStyleAttribute
= $('elementWithoutStyleAttribute'),
34 elementWithEmptyStyleAttribute
= $('elementWithEmptyStyleAttribute'),
35 elementWithStyleAttribute
= $('elementWithStyleAttribute'),
36 elementWithoutStyleAttribute2
= $('elementWithoutStyleAttribute2'),
37 elementWithoutStyleAttribute3
= $('elementWithoutStyleAttribute3'),
38 elementWithoutStyleAttribute4
= $('elementWithoutStyleAttribute4');
40 shouldBe("elementWithoutStyleAttribute.style.backgroundColor = 'red'; elementWithoutStyleAttribute.removeAttribute('style'); getComputedStyle(elementWithoutStyleAttribute).backgroundColor", '"rgba(0, 0, 0, 0)"');
42 elementWithEmptyStyleAttribute
.style
.backgroundColor
= 'red';
43 elementWithEmptyStyleAttribute
.removeAttribute('style');
44 shouldBe("getComputedStyle(elementWithEmptyStyleAttribute).backgroundColor", '"rgba(0, 0, 0, 0)"');
46 elementWithStyleAttribute
.style
.backgroundColor
= 'red';
47 elementWithStyleAttribute
.removeAttribute('style');
48 shouldBe("getComputedStyle(elementWithStyleAttribute).backgroundColor", '"rgba(0, 0, 0, 0)"');
50 shouldBeNull("elementWithoutStyleAttribute2.getAttribute('style')");
51 shouldBe("elementWithoutStyleAttribute2.style.backgroundColor = 'red'; elementWithoutStyleAttribute2.removeAttribute('style'); getComputedStyle(elementWithoutStyleAttribute2).backgroundColor", '"rgba(0, 0, 0, 0)"');
53 elementWithoutStyleAttribute3
.style
.backgroundColor
= 'red';
54 shouldBe("elementWithoutStyleAttribute3.getAttribute('style')", '"background-color: red;"');
55 elementWithoutStyleAttribute3
.removeAttribute('style');
56 shouldBe("getComputedStyle(elementWithoutStyleAttribute3).backgroundColor", '"rgba(0, 0, 0, 0)"');
58 shouldBe("elementWithoutStyleAttribute4.style.backgroundColor = 'red'; elementWithoutStyleAttribute4.setAttribute('style', ''); elementWithoutStyleAttribute4.removeAttribute('style'); getComputedStyle(elementWithoutStyleAttribute4).backgroundColor", '"rgba(0, 0, 0, 0)"');
61 return document
.getElementById(id
);
64 document
.getElementById('table').innerHTML
= '';