<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<style id="sty">
    input { background: blue; }
</style>
</head>
<body>
<p id="description"></p>
<form method="get">
<input name="victim" type="text"/>
<input name="victim" type="text" value="Loremipsum" pattern="Lorem ipsum"/>
</form>
<div id="console"></div>
<script>
description("This test checks that input element that share style, no longer share style after validity rules are dynamically added.");

var s1 = document.getElementById('sty').sheet;
s1.insertRule(':valid { background: lime; }', s1.cssRules.length);

v = document.getElementsByTagName("input");

shouldBe("document.defaultView.getComputedStyle(v[0], null).getPropertyValue('background-color')", "'rgb(0, 255, 0)'");
shouldBe("document.defaultView.getComputedStyle(v[1], null).getPropertyValue('background-color')", "'rgb(0, 0, 255)'");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
