-
Notifications
You must be signed in to change notification settings - Fork 0
/
QA_file.html
96 lines (93 loc) · 2.24 KB
/
QA_file.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
<html>
<head>
<title></title>
<script type="text/javascript">
(function (window){
function isRowTarget(node){
var elm = node;
var foundTarget = false;
if(elm !== undefined && elm !== null && elm.nodeName == "TR"){
if(Array.prototype.slice.call(elm.classList).indexOf("route_row") >= 0){
foundTarget = true;
}
}
if(foundTarget){
return elm;
} else {
return false;
}
}
function isDelegatedTarget(node){
var isDelegate = (node !== null && node.id == 'test_root');
var result = isRowTarget(node);
var found = (isDelegate || result);
if(!found && node){
return isDelegatedTarget(node.parentNode);
} else {
return result;
}
}
function toggleHighlight(evt){
evt.stopPropagation();
var targetClicked = isDelegatedTarget(evt.target);
if(targetClicked){
if (targetClicked.classList.contains("frozen")){
targetClicked.classList.remove("frozen");
} else {
targetClicked.classList.add("frozen");
}
}
}
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = 'tr.route_row:hover { background-color: #ddfcf7; } .frozen { background-color: #fcfadd; }';
document.getElementsByTagName('head')[0].appendChild(style);
document.addEventListener('dblclick', toggleHighlight);
})(window);
</script>
</head>
<body>
<h1 style="text-align:center;">double click any row</h1>
<table id="test_root" style="width:50%; margin:0 auto; outline:1px solid red;">
<tr id="test" class="route_row">
<td>(test) control row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_row">
<td>row</td>
</tr>
<tr class="route_rowsssssss">
<td>(disabled) row should not highlight</td>
</tr>
</table>
</body>
</html>