blob: b4e74482f4ea9208400e70289cb10bc752afdec7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.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>
</body>
</html>