summaryrefslogtreecommitdiffstats
path: root/dom/base/test/test_e4x_for_each.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/test/test_e4x_for_each.html')
-rw-r--r--dom/base/test/test_e4x_for_each.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/dom/base/test/test_e4x_for_each.html b/dom/base/test/test_e4x_for_each.html
new file mode 100644
index 000000000..3d1ffa57a
--- /dev/null
+++ b/dom/base/test/test_e4x_for_each.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head><meta charset=utf-8>
+ <title>Test for E4X "for each" syntax</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<div id="template" style="display: none">
+function runTest(i) {
+ var t = tests[i];
+ count++;
+ try {
+ Function("for each (var a in []) {}");
+ ok(t.enabled, "JavaScript" + ("version" in t ? " " + t.version : "") + " supports for-each-in");
+ } catch (e) {
+ ok(!t.enabled, "JavaScript" + ("version" in t ? " " + t.version : "") + " does NOT support for-each-in");
+ }
+}
+</div>
+<pre id="test">
+<script class="testbody">
+
+var tests = [
+ {enabled: false},
+ {version: "1.0", enabled: false},
+ {version: "1.1", enabled: false},
+ {version: "1.2", enabled: false},
+ {version: "1.3", enabled: false},
+ {version: "1.4", enabled: false},
+ {version: "1.5", enabled: false},
+ {version: "1.6", enabled: true},
+ {version: "1.7", enabled: true},
+ {version: "1.8", enabled: true},
+];
+
+var count = 0;
+for (var i = 0; i < tests.length; i++) {
+ var t = tests[i];
+ var script = document.createElement("script");
+ script.type = "application/javascript" + ("version" in t ? ";version=" + t.version : "");
+ script.textContent = document.getElementById("template").textContent + "\n" + "runTest(" + i + ");";
+ document.body.appendChild(script);
+}
+script = document.createElement("script");
+script.textContent = 'is(count, tests.length, "runTest() call count");';
+document.body.appendChild(script);
+</script>
+</pre>
+</body>
+</html>