blob: 254fcbe4c90a6a6deca162203f9c4b51e3cfa6ed (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
<!DOCTYPE html>
<html>
<head>
<title>hover ancestor test</title>
<style type="text/css" media="screen">
.foo {
background: red;
width: 300px;
height: 300px;
position: relative;
}
.foo:hover {
background: green;
}
</style>
</head>
<body>
<p>This test ensures that ancestor element hover rules are not affected when we hover
its contained elements</p>
<div class="foo" id="target">
<select class="select" id="testselect" size="3">
<option value="option1">option1</option>
<option value="option1">option2</option>
<option selected="selected" value="option2">option3</option>
</select>
<br>
<input type="text" name="fname" id="testinput"/>
<br>
<textarea rows="2" cols="20" id="testtextarea">Textarea test.</textarea>
<br>
<a id="testanchor" href="webkit.org">http://www.webkit.org</a>
<br>
<button type="button" id="testbutton">Button test</button>
<br>
<form>
<input type="radio" id="testradio"/>Radio test
<br>
<input type="checkbox" id="testcheckbox"/>Checkbox test
<br>
</form>
</div>
<script type="text/javascript">
if (window.testRunner) {
testRunner.dumpAsText();
}
function getCenterFor(element)
{
var rect = element.getBoundingClientRect();
return { x : parseInt((rect.left + rect.right) / 2) , y : parseInt((rect.top + rect.bottom) / 2)};
}
function runTest(id) {
var box, x, y;
box = document.getElementById(id);
center = getCenterFor(box);
eventSender.mouseMoveTo(center.x, center.y);
var target = document.getElementById("target");
var style = window.getComputedStyle(target, null);
var bgColor = style.getPropertyValue("background-color");
logResult(id, bgColor);
}
function logResult(id, bgColor) {
document.write(id + ': ');
document.write(bgColor=="rgb(0, 128, 0)" ? "PASS" : "FAIL");
document.write('<br>');
}
if (window.eventSender) {
runTest("testselect");
runTest("testinput");
runTest("testtextarea");
runTest("testanchor");
runTest("testbutton");
runTest("testradio");
runTest("testcheckbox");
}
</script>
</body>
</html>
|