2 <script src=
"../../../resources/js-test.js"></script>
4 description('Tests that modifying the class attribute updates the classList on non HTMLElements');
6 function updateAndTestClassAttr(varName
) {
7 eval(varName
+ '.setAttribute("class", "' + varName
+ '")');
8 shouldBe(varName
+ '.classList.length', '1');
9 eval(varName
+ '.setAttribute("class", "")');
10 shouldBe(varName
+ '.classList.length', '0');
13 var htmlElement
= document
.createElement('div');
14 updateAndTestClassAttr('htmlElement');
16 var svgElement
= document
.createElementNS('http://www.w3.org/2000/svg', 'svg');
17 updateAndTestClassAttr('svgElement');
19 var xmlElement
= document
.createElementNS('http://www.example.com', 'xml');
20 updateAndTestClassAttr('xmlElement');