<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<style>
div.class { background-color: red; }
div.class:nth-of-type(3n
 +   1) {background-color: green;}
</style>

</head>
<body>
<div tabindex=1" id="first" class="class"></div>
<div tabindex=2" id="second" class="class"></div>
<div tabindex=3" id="third" class="class"></div>
<div tabindex=4" id="fourth" class="class"></div>
<div id="console"></div>
<script>
description('This test passes if the nth-of-type(3n + 1) is parsed correctly, regardless of the whitespaces.');



el = document.getElementById("first");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 128, 0)'");

el = document.getElementById("second");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");

el = document.getElementById("third");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");

el = document.getElementById("fourth");
shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 128, 0)'");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
