Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / array-indexof.html
blob00646eb963413b2f9074e617e195818fc36c3850
1 <html>
2 <head>
3 <script type="text/javascript">
4 <!--
6 var testArray = new Array("Hello", "Hi", true, 5, 5, 9, null, undefined);
7 var testArray2 = new Array("Hello", "Hi", true, 5, 5, 9);
8 var testArray3 = new Object;
9 testArray3.__proto__ = testArray2.__proto__;
10 testArray3[0] = "Hello";
11 testArray3[1] = "Hi";
12 testArray3[2] = true;
13 testArray3[3] = 5;
14 testArray3[4] = 5;
15 testArray3[5] = 9;
16 testArray3.length = 6;
17 var testArray4 = [5, 5, 5, undefined];
18 delete testArray4[1];
19 var testArray5 = [5, 5, 5, undefined];
20 delete testArray5[3];
21 var testArray6 = new Array(20);
22 if (window.testRunner)
23 testRunner.dumpAsText();
25 // -->
26 </script>
27 </head>
28 <body>
30 <p>1.0 Direct Testing, no starting at Parameter<br>
31 * The indexOf String "Hello" is <script>document.write(testArray.indexOf("Hello"))</script><br>
32 * The indexOf String "Hi" is <script>document.write(testArray.indexOf("Hi"))</script><br>
33 * The indexOf Boolean 'true' is <script>document.write(testArray.indexOf( true ))</script><br>
34 * The indexOf Number '5' is <script>document.write(testArray.indexOf( 5 ))</script><br>
35 * The indexOf Number '9' is <script>document.write(testArray.indexOf( 9 ))</script>
36 </p>
38 <p>2.0 A firstIndex parameter of 1 (positive offset test)<br>
39 * The indexOf String "Hi" is <script>document.write(testArray.indexOf("Hi",1))</script><br>
40 * The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true,1))</script><br>
41 * The indexOf Number 5 is <script>document.write(testArray.indexOf(5,1))</script><br>
42 * The indexOf Number 9 is <script>document.write(testArray.indexOf(9,1))</script>
43 </p>
45 <p>3.0 A firstIndex parameter of -4 (negative offset test)<br>
46 * The indexOf String "Hi" is <script>document.write(testArray.indexOf("Hi",-4))</script><br>
47 * The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true,-4))</script><br>
48 * The indexOf Number 5 is <script>document.write(testArray.indexOf(5,-4))</script><br>
49 * The indexOf Number 9 is <script>document.write(testArray.indexOf(9,-4))</script>
50 </p>
52 <p>4.0 A big positive firstIndex of 1000, to test the firstIndex > length<br>
53 * The indexOf Number '9' is <script>document.write(testArray.indexOf(9,1000))</script>
54 </p>
56 <p>5.0 A big positive firstIndex of 4294967301, to test when firstIndex > width of int (32-bits)<br>
57 * The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true, 4294967301))</script>
58 </p>
60 <p>6.0 No arguments<br>
61 * No arguments passed: <script>document.write(testArray.indexOf())</script><br>
62 * No arguments passed: <script>document.write(testArray2.indexOf())</script>
63 </p>
65 <p>7.0 Looking for null<br>
66 * The indexOf null is <script>document.write(testArray.indexOf(null))</script><br>
67 * The indexOf null is <script>document.write(testArray2.indexOf(null))</script>
68 </p>
70 <p>8.0 Extra arguments<br>
71 * The indexOf String "Hello" is <script>document.write(testArray.indexOf("Hello", 0, true))</script>
72 </p>
74 <p>9.0 NaN firstIndex<br>
75 * The indexOf String "Hi" is <script>document.write(testArray.indexOf("Hello", "Hey"))</script>
76 </p>
78 <p>10.0 Small firstIndex<br>
79 * The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true, 0.45))</script>
80 </p>
82 <p>11.0 Negative firstIndex bigger than the length of the array<br>
83 * The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true, -1000))</script>
84 </p>
86 <p>12.0 Negative firstIndex bigger than 32-bits<br>
87 * The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true, -5294967301))</script>
88 </p>
90 <p>13.0 Looking for undefined<br>
91 * The indexOf undefined is <script>document.write(testArray.indexOf(undefined))</script><br>
92 * The indexOf undefined is <script>document.write(testArray2.indexOf(undefined))</script><br>
93 * The indexOf undefined is <script>document.write(testArray4.indexOf(undefined))</script><br>
94 * The indexOf undefined is <script>document.write(testArray5.indexOf(undefined))</script><br>
95 * The indexOf undefined is <script>document.write(testArray6.indexOf(undefined))</script>
96 </p>
98 <p>14.0 Object using the Array prototype<br>
99 * The indexOf String "Hello" is <script>document.write(testArray3.indexOf("Hello"))</script><br>
100 * The indexOf String "Hi" is <script>document.write(testArray3.indexOf("Hi"))</script><br>
101 * The indexOf Boolean 'true' is <script>document.write(testArray3.indexOf(true))</script><br>
102 * The indexOf Number '5' is <script>document.write(testArray3.indexOf(5))</script><br>
103 * The indexOf Number '9' is <script>document.write(testArray3.indexOf(9))</script>
104 </p>
106 </body>
107 </html>