<!DOCTYPE html>
<script src="../../../resources/js-test-pre.js"></script>
<script>
description('Tests that modifying the class attribute updates the classList on non HTMLElements');

function updateAndTestClassAttr(varName) {
    eval(varName + '.setAttribute("class", "' + varName + '")');
    shouldBe(varName + '.classList.length', '1');
    eval(varName + '.setAttribute("class", "")');
    shouldBe(varName + '.classList.length', '0');
}

var htmlElement = document.createElement('div');
updateAndTestClassAttr('htmlElement');

var svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
updateAndTestClassAttr('svgElement');

var xmlElement = document.createElementNS('http://www.example.com', 'xml');
updateAndTestClassAttr('xmlElement');

</script>
<script src="../../../resources/js-test-post.js"></script>
