3 <title>Test for named getter enumerability
</title>
4 <script src=
"/resources/testharness.js"></script>
5 <script src=
"/resources/testharnessreport.js"></script>
8 /* global test, assert_equals, assert_true, assert_false, assert_not_equals */
10 var list
= document
.getElementsByTagName("div");
11 var desc
= Object
.getOwnPropertyDescriptor(list
, "0");
12 assert_equals(typeof desc
, "object", "Should have a '0' property");
13 assert_true(desc
.enumerable
, "'0' property should be enumerable");
14 desc
= Object
.getOwnPropertyDescriptor(list
, "log");
15 assert_equals(typeof desc
, "object", "Should have a 'log' property");
16 assert_false(desc
.enumerable
, "'log' property should not be enumerable");
17 }, "Correct getOwnPropertyDescriptor behavior");
19 var list
= document
.getElementsByTagName("div");
21 for (var prop
in list
) {
24 assert_not_equals(props
.indexOf("0"), -1, "Should enumerate '0'");
25 assert_equals(props
.indexOf("log"), -1, "Should not enumerate 'log'");
26 }, "Correct enumeration behavior");
28 var list
= document
.getElementsByTagName("div");
29 var props
= Object
.keys(list
);
30 assert_not_equals(props
.indexOf("0"), -1, "Keys should contain '0'");
31 assert_equals(props
.indexOf("log"), -1, "Keys should not contain 'log'");
32 }, "Correct keys() behavior");
34 var list
= document
.getElementsByTagName("div");
35 var props
= Object
.getOwnPropertyNames(list
);
36 assert_not_equals(props
.indexOf("0"), -1,
37 "own prop names should contain '0'");
38 assert_not_equals(props
.indexOf("log"), -1,
39 "own prop names should contain 'log'");
40 }, "Correct getOwnPropertyNames() behavior");