diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-languages-02.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-languages-02.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-languages-02.html | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-languages-02.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-languages-02.html new file mode 100644 index 000000000..69613e510 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-languages-02.html @@ -0,0 +1,98 @@ +<!DOCTYPE html> +<title>Script @type: JavaScript types</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#scriptingLanguages"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +function testAttribute(attr, val, shouldRun) { + test(function() { + assert_false(ran, "ran variable not reset"); + var script = document.createElement("script"); + script.setAttribute(attr, val); + script.textContent = "ran = true;" + document.body.appendChild(script); + assert_equals(ran, shouldRun); + }, "Script should" + (shouldRun ? "" : "n't") + " run with " + attr + "=" + format_value(val)); + ran = false +} +function testType(type) { + testAttribute("type", type, true); +} +function testLanguage(lang) { + testAttribute("language", lang, true); +} +function testTypeIgnored(type) { + testAttribute("type", type, false); +} +function testLanguageIgnored(lang) { + testAttribute("language", lang, false); +} +var application = [ + "ecmascript", + "javascript", + "x-ecmascript", + "x-javascript" +]; +var text = [ + "ecmascript", + "javascript", + "javascript1.0", + "javascript1.1", + "javascript1.2", + "javascript1.3", + "javascript1.4", + "javascript1.5", + "jscript", + "livescript", + "x-ecmascript", + "x-javascript" +]; +var spaces = [" ", "\t", "\n", "\r", "\f"]; + +var ran = false; + +// Type attribute + +testType(""); +testTypeIgnored(" "); + +application.map(function(t) { return "application/" + t; }).forEach(testType); +application.map(function(t) { return ("application/" + t).toUpperCase(); }).forEach(testType); + +spaces.forEach(function(s) { + application.map(function(t) { return "application/" + t + s; }).forEach(testType); + application.map(function(t) { return s + "application/" + t; }).forEach(testType); +}) + +application.map(function(t) { return "application/" + t + "\0"; }).forEach(testTypeIgnored); +application.map(function(t) { return "application/" + t + "\0foo"; }).forEach(testTypeIgnored); + +text.map(function(t) { return "text/" + t; }).forEach(testType); +text.map(function(t) { return ("text/" + t).toUpperCase(); }).forEach(testType); + +spaces.forEach(function(s) { + text.map(function(t) { return "text/" + t + s; }).forEach(testType); + text.map(function(t) { return s + "text/" + t; }).forEach(testType); +}) + +text.map(function(t) { return "text/" + t + "\0"; }).forEach(testTypeIgnored); +text.map(function(t) { return "text/" + t + "\0foo"; }).forEach(testTypeIgnored); + +// Language attribute + +testLanguage(""); +testLanguageIgnored(" "); + +text.forEach(testLanguage); +text.map(function(t) { return t.toUpperCase(); }).forEach(testLanguage); + +text.map(function(t) { return t + " "; }).forEach(testLanguageIgnored); +text.map(function(t) { return " " + t; }).forEach(testLanguageIgnored); +text.map(function(t) { return t + "xyz"; }).forEach(testLanguageIgnored); +text.map(function(t) { return "xyz" + t; }).forEach(testLanguageIgnored); + +text.map(function(t) { return t + "\0"; }).forEach(testLanguageIgnored); +text.map(function(t) { return t + "\0foo"; }).forEach(testLanguageIgnored); +</script> |