forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontextmenu-key.html
112 lines (87 loc) · 1.9 KB
/
contextmenu-key.html
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html>
<head>
<style>
#outer {
overflow: auto;
width: 200px;
height: 200px;
}
#inner {
position: relative;
height: 400px;
}
#inner:focus {
background-color: lightblue;
}
#inner:active {
background-color: blue;
}
#h, #h2 {
background: rgba(255, 255, 255, 0);
}
#h {
position: absolute;
height: 200px;
width: 200px;
}
#h2 {
position: absolute;
top: 200px;
height: 200px;
width: 100%;
}
#h:hover,
#h2:hover {
background: pink;
}
#h:active,
#h2:active {
background: red;
}
pre {
position: absolute;
left: 250px;
top: 80px;
}
</style>
</head>
<body>
<p>Manual test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38129">bug 38129</a></p>
<p>Click the div below and press the context menu key on your keyboard (Shift+F10 also works)</p>
<div id=outer>
<div id=inner tabindex=0>
<div id=h2></div>
</div>
</div>
<div id=h></div>
<pre></pre>
<script>
function cs(el)
{
if (window.getComputedStyle)
return window.getComputedStyle(el, '');
return el.currentStyle;
}
document.addEventListener('contextmenu', function(e)
{
var inner = document.querySelector('#inner');
var outer = document.querySelector('#outer');
var h = document.querySelector('#h');
var h2 = document.querySelector('#h2');
var result = [];
result.push(e.target, document.querySelector('#inner'));
result.push(cs(inner, '').backgroundColor, 'rgb(0, 0, 255)');
result.push(cs(h, '').backgroundColor, 'rgba(255, 255, 255, 0)');
result.push(cs(h2, '').backgroundColor, 'rgba(255, 255, 255, 0)');
var s = '';
for (var i = 0; i < result.length; i += 2) {
s += result[i] + ' == ' + result[i + 1] + ' - ' +
(result[i] == result[i + 1] ? 'PASS' : 'FAIL') + '<br>';
}
document.querySelector('pre').innerHTML = s;
return true;
}, false);
</script>
</body>
</html>