summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/click-method-on-html-element.html
blob: b7d556838eadb2485e2f8d863db9a465ceeffa81 (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
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p>The support of click() method on HTMLElement.</p>
<div id="console"></div>
<script>
var success;
function clickHandler(event) {
    success = true;
}

function runTests(tagName) {
    success = false;
    var element = document.createElement(tagName);
    element.addEventListener('click', clickHandler, false);

    element.click();
    if (success)
        debug("Pass: Click event handler called for: " + tagName);
    else
        debug("Pass: Click event handler wasn't called for: " + tagName);
}

var tagNames = ["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdo","bgsound","big","blockquote",
    "body","br","button","canvas","caption","center","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt",
    "em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html",
    "i","iframe","img","input","ins","isindex","kbd","keygen","label","layer","legend","li","link","listing","main","map","mark","marquee","menu","meta","meter","nav",
    "nobr","noembed","noframes","nolayer","noscript","object","ol","optgroup","option","output","p","param","plaintext","pre","progress","q","rp","rt","ruby","s",
    "samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead",
    "title","tr","track","tt","u","ul","var","video","wbr","xmp"];

for (var i =0 ; i < tagNames.length; i++)
    runTests(tagNames[i]);

</script>
</body>
</html>