PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/testability-explorer/src/main/resources/com/google/test/metric/report/html/report.js

http://testability-explorer.googlecode.com/
JavaScript | 31 lines | 28 code | 3 blank | 0 comment | 13 complexity | 0f0574dcb726ddffae0e000e82ca29cf MD5 | raw file
 1
 2function toggle(element) {
 3  var currentStyle = element.style.display;
 4  element.style.display = 'block' == currentStyle ? 'none' : 'block';
 5}
 6
 7function toggleExpandSign(element) {
 8  if (element.firstChild.className == 'expand') {
 9    var expand = element.firstChild;
10  } else if (element.className == 'expand') {
11    var expand = element;
12  } else {
13    return;
14  }
15  expand.innerHTML = expand.innerHTML == '[+]' ? '[-]' : '[+]';
16}
17     
18function clickHandler(event) {
19  var element = event.target;
20  toggleExpandSign(element);
21  if (element.className == 'expand') {
22    element = element.parentNode;
23  }
24  var children = element.childNodes;
25  for (var i=0; i < children.length; i++) {
26    var child = children[i];
27    if (child.nodeName == 'DIV') {
28      toggle(child);
29    }
30  }
31}