summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/pseudo-valid-dynamic.html
blob: b4e74482f4ea9208400e70289cb10bc752afdec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!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>