dom/tests/mochitest/whatwg/test_document_scripts.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/whatwg/test_document_scripts.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=685774
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for document.scripts (Bug 685774)</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685774">Mozilla Bug 685774</a>
    1.17 +<script type="application/javascript">
    1.18 +
    1.19 +/** Test for Bug 685774 **/
    1.20 +
    1.21 +function testSameCollection(a, b, c) {
    1.22 +  is(a.length, c, "unexpected count of script elements");
    1.23 +  is(b.length, c, "unexpected count of script elements");
    1.24 +  for (var i = 0; i < a.length; i++) {
    1.25 +    is(a[i], b[i], "document.scripts is not supported");
    1.26 +  }
    1.27 +}
    1.28 +
    1.29 +SimpleTest.waitForExplicitFinish();
    1.30 +
    1.31 +testSameCollection(document.scripts, document.getElementsByTagName("script"), 3);
    1.32 +
    1.33 +</script>
    1.34 +<script type="application/javascript">
    1.35 +
    1.36 +testSameCollection(document.scripts, document.getElementsByTagName("script"), 4);
    1.37 +
    1.38 +function start() {
    1.39 +  testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
    1.40 +
    1.41 +  var e = document.createElement("script");
    1.42 +  testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
    1.43 +  document.body.appendChild(e);
    1.44 +  testSameCollection(document.scripts, document.getElementsByTagName("script"), 6);
    1.45 +
    1.46 +  SimpleTest.finish();
    1.47 +}
    1.48 +
    1.49 +addLoadEvent(start);
    1.50 +
    1.51 +</script>
    1.52 +<script type="application/javascript">
    1.53 +
    1.54 +testSameCollection(document.scripts, document.getElementsByTagName("script"), 5);
    1.55 +
    1.56 +</script>
    1.57 +</body>
    1.58 +</html>

mercurial