summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/select/select-namedItem.html
blob: d0fd23364868e9d745c479f9342117d111ee604a (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
<html>
<head>
<script>
function print(message, color) 
{
    var paragraph = document.createElement("div");
    paragraph.appendChild(document.createTextNode(message));
    paragraph.style.fontFamily = "monospace";
    if (color)
        paragraph.style.color = color;
    document.getElementById("console").appendChild(paragraph);
}

function test() 
{

    var selects = document.getElementsByTagName('select');
    for (var i = 0; i < selects.length; i++) { // >
        try {
            var item = document.getElementsByTagName('select')[i].namedItem('name1');
            if (item.innerHTML)
                print("FOUND ITEM: " + item.innerHTML);
            else
                print("NO ITEM: namedItem returned" + item);
        } catch (e) {
            print("ERROR: " + e.message);
        }
    }
    if (window.testRunner)
        testRunner.dumpAsText();
}
</script>
<title>Test for HTMLSelectElement.namedItem()</title>
</head>

<body onload="test();">

<hr>
<div id='console'>
<H3>Test for HTMLSelectElement.namedItem()</H3>
</div>

<div style="visibility: hidden">
    <select>
        <option name="name1">1</option>
        <option id="name1">2</option>
    </select>

    <select>
        <option id="name1">1</option>
        <option name="name1">2</option>
    </select>

    <select>
        <option name="name1">1</option>
        <option name="name1">2</option>
    </select>

    <select>
        <option id="name1">1</option>
        <option id="name1">2</option>
    </select>

    <select name="name1">
        <option id="name2">1</option>
        <option id="name3">2</option>
    </select>

</div>

</body>
</html>