Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=685774
5 -->
6 <head>
7 <title>Test for document.scripts (Bug 685774)</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685774">Mozilla Bug 685774</a>
14 <script type="application/javascript">
16 /** Test for Bug 685774 **/
18 function testSameCollection(a, b, c) {
19 is(a.length, c, "unexpected count of script elements");
20 is(b.length, c, "unexpected count of script elements");
21 for (var i = 0; i < a.length; i++) {
22 is(a[i], b[i], "document.scripts is not supported");
23 }
24 }
26 SimpleTest.waitForExplicitFinish();
28 testSameCollection(document.scripts, document.getElementsByTagName("script"), 3);
30 </script>
31 <script type="application/javascript">
33 testSameCollection(document.scripts, document.getElementsByTagName("script"), 4);
35 function start() {
36 testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
38 var e = document.createElement("script");
39 testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
40 document.body.appendChild(e);
41 testSameCollection(document.scripts, document.getElementsByTagName("script"), 6);
43 SimpleTest.finish();
44 }
46 addLoadEvent(start);
48 </script>
49 <script type="application/javascript">
51 testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
53 </script>
54 </body>
55 </html>