-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement HTMLScriptElement.supports(type) method
Bug: 1245528, whatwg/html#6472 Change-Id: I9a902504cf692caa73ae7e49fd65895156bbf197 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133553 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#918474} NOKEYCHECK=True GitOrigin-RevId: b8b24648e5716bd4e7f7cb77cb792163e8599149
- Loading branch information
1 parent
469cc53
commit 9f181a3
Showing
8 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...web_tests/external/wpt/html/semantics/scripting-1/the-script-element/script-supports.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>HTMLScriptElement.supports</title> | ||
<link rel=help href="https://html.spec.whatwg.org/#dom-script-supports"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
test(function() { | ||
assert_equals(typeof HTMLScriptElement.supports, 'function'); | ||
}, 'Type of HTMLScriptElement.supports is function'); | ||
|
||
test(function() { | ||
assert_true(HTMLScriptElement.supports('classic')); | ||
}, 'HTMLScriptElement.supports resurns true for \'classic\''); | ||
|
||
test(function() { | ||
assert_true(HTMLScriptElement.supports('module')); | ||
}, 'HTMLScriptElement.supports resurns true for \'module\''); | ||
|
||
test(function() { | ||
assert_false(HTMLScriptElement.supports('application/ecmascript')); | ||
assert_false(HTMLScriptElement.supports('application/javascript')); | ||
assert_false(HTMLScriptElement.supports('application/x-ecmascript')); | ||
assert_false(HTMLScriptElement.supports('application/x-javascript')); | ||
assert_false(HTMLScriptElement.supports('text/ecmascript')); | ||
assert_false(HTMLScriptElement.supports('text/javascript')); | ||
assert_false(HTMLScriptElement.supports('text/javascript1.0')); | ||
assert_false(HTMLScriptElement.supports('text/javascript1.1')); | ||
assert_false(HTMLScriptElement.supports('text/javascript1.2')); | ||
assert_false(HTMLScriptElement.supports('text/javascript1.3')); | ||
assert_false(HTMLScriptElement.supports('text/javascript1.4')); | ||
assert_false(HTMLScriptElement.supports('text/javascript1.5')); | ||
assert_false(HTMLScriptElement.supports('text/jscript')); | ||
assert_false(HTMLScriptElement.supports('text/livescript')); | ||
assert_false(HTMLScriptElement.supports('text/x-ecmascript')); | ||
assert_false(HTMLScriptElement.supports('text/x-javascript')); | ||
}, 'HTMLScriptElement.supports returns false for JavaScript MIME types'); | ||
|
||
test(function() { | ||
assert_false(HTMLScriptElement.supports('')); | ||
assert_false(HTMLScriptElement.supports(' ')); | ||
assert_false(HTMLScriptElement.supports('classic ')); | ||
assert_false(HTMLScriptElement.supports('module ')); | ||
assert_false(HTMLScriptElement.supports(' classic ')); | ||
assert_false(HTMLScriptElement.supports(' module ')); | ||
assert_false(HTMLScriptElement.supports('classics')); | ||
assert_false(HTMLScriptElement.supports('modules')); | ||
assert_false(HTMLScriptElement.supports('Classic')); | ||
assert_false(HTMLScriptElement.supports('Module')); | ||
assert_false(HTMLScriptElement.supports('unsupported')); | ||
}, 'HTMLScriptElement.supports returns false for unsupported types'); | ||
</script> |
22 changes: 22 additions & 0 deletions
22
blink/web_tests/external/wpt/import-maps/script-supports-importmap.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<title>HTMLScriptElement.supports importmap</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
test(function() { | ||
assert_true(HTMLScriptElement.supports('importmap')); | ||
}, 'HTMLScriptElement.supports returns true for \'importmap\''); | ||
|
||
test(function() { | ||
assert_false(HTMLScriptElement.supports(' importmap')); | ||
assert_false(HTMLScriptElement.supports('importmap ')); | ||
assert_false(HTMLScriptElement.supports('Importmap')); | ||
assert_false(HTMLScriptElement.supports('ImportMap')); | ||
assert_false(HTMLScriptElement.supports('importMap')); | ||
assert_false(HTMLScriptElement.supports('import-map')); | ||
assert_false(HTMLScriptElement.supports('importmaps')); | ||
assert_false(HTMLScriptElement.supports('import-maps')); | ||
}, 'HTMLScriptElement.supports returns false for unsupported types'); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
blink/web_tests/wpt_internal/prerender/script-supports-speculationrules.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<title>HTMLScriptElement.supports speculationrules</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<meta name="timeout" content="long"> | ||
<script> | ||
test(function() { | ||
assert_true(HTMLScriptElement.supports('speculationrules')); | ||
}, 'HTMLScriptElement.supports returns true for \'speculationrules\''); | ||
|
||
test(function() { | ||
assert_false(HTMLScriptElement.supports(' speculationrules')); | ||
assert_false(HTMLScriptElement.supports('speculationrules ')); | ||
assert_false(HTMLScriptElement.supports('Speculationrules')); | ||
assert_false(HTMLScriptElement.supports('SpeculationRules')); | ||
assert_false(HTMLScriptElement.supports('speculationRules')); | ||
assert_false(HTMLScriptElement.supports('speculation-rules')); | ||
}, 'HTMLScriptElement.supports returns false for unsupported types'); | ||
|
||
</script> |