chromium/third_party/blink/web_tests/fast/dom/Element/class-list-update.html

<!DOCTYPE html>
<script src="../../../resources/js-test.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>