about summary refs log blame commit diff stats
path: root/test/js/class.html
blob: 7c14049ee96e4edf88f34b83e9852061a833499a (plain) (tree)






















                                                         
<!doctype html>
<title>Element class test</title>
<div class="a b c">Fail</div>
<script>
(function() {
	let div = document.getElementsByClassName("a")[0]
	const classes = ["a", "b", "c"];
	let cl = div.classList;
	for (let i = 0; i < classes.length; ++i) {
		if (cl[i] !== classes[i])
			return;
	}
	const classes2 = ["x", "y", "z"];
	div.setAttribute("class", classes2.join(' '));
	let i = 0;
	for (let x of cl) {
		if (x != classes2[i])
			return;
		++i;
	}
	div.textContent = "Success";
})();
</script>