Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/interfaces.html

Issue 1962003002: Import web-platform-tests@41d6911b288a9624c249a406b9bf51607a2dd04d (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip submit-entity-body.html Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Test of interfaces</title> 2 <title>Test of interfaces</title>
3 <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com"> 3 <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
4 <link rel="help" href="https://html.spec.whatwg.org/multipage/"> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/">
5 <link rel="help" href="https://heycam.github.io/webidl/#host-objects"> 5 <link rel="help" href="https://heycam.github.io/webidl/#host-objects">
6 <link rel="help" href="http://www.ecma-international.org/publications/files/ECMA -ST/ECMA-262.pdf#page=96"> 6 <link rel="help" href="http://www.ecma-international.org/publications/files/ECMA -ST/ECMA-262.pdf#page=96">
7 <script src="../../../../resources/testharness.js"></script> 7 <script src="../../../../resources/testharness.js"></script>
8 <script src="../../../../resources/testharnessreport.js"></script> 8 <script src="../../../../resources/testharnessreport.js"></script>
9 <script src=interfaces.js></script> 9 <script src=interfaces.js></script>
10 <div id="log"></div> 10 <div id="log"></div>
11 <script> 11 <script>
12 function do_test(local_name, iface) { 12 function do_test(local_name, iface, variant) {
13 test(function() { 13 test(function() {
14 var e = document.createElement(local_name), i = "HTML" + iface + "Element"; 14 var e;
15 var i = "HTML" + iface + "Element";
16 if (variant === "useNS") {
17 // Use createElementNS here to preserve the case of local_name.
18 e = document.createElementNS("http://www.w3.org/1999/xhtml", local_name);
19 } else {
20 e = document.createElement(local_name);
21 }
15 assert_class_string(e, i, 22 assert_class_string(e, i,
16 "Element " + local_name + " should have " + i + 23 "Element " + local_name + " should have " + i +
17 " as its primary interface."); 24 " as its primary interface.");
18 assert_true(e instanceof window[i], 25 assert_true(e instanceof window[i],
19 "Element " + local_name + " should implement " + i + "."); 26 "Element " + local_name + " should implement " + i + ".");
20 assert_true(e instanceof HTMLElement, 27 assert_true(e instanceof HTMLElement,
21 "Element " + local_name + " should implement HTMLElement."); 28 "Element " + local_name + " should implement HTMLElement.");
22 assert_true(e instanceof Element, 29 assert_true(e instanceof Element,
23 "Element " + local_name + " should implement Element."); 30 "Element " + local_name + " should implement Element.");
24 assert_true(e instanceof Node, 31 assert_true(e instanceof Node,
25 "Element " + local_name + " should implement Node."); 32 "Element " + local_name + " should implement Node.");
26 }, "Interfaces for " + local_name); 33 }, "Interfaces for " + local_name);
27 } 34 }
28 35
29 elements.forEach(function(a) { 36 elements.forEach(function(a) {
30 do_test(a[0], a[1]); 37 do_test(a[0], a[1], "useNS");
31 do_test(a[0].toUpperCase(), a[1]); 38
39 // Only run the createElement variant if the input is all-lowercase, because c reateElement
40 // case-folds to lowercase. Custom elements are required to use all-lowercase to implement
41 // HTMLElement, otherwise they use HTMLUnknownElement per spec. Example: "foo- BAR".
42 if (a[0] === a[0].toLowerCase()) {
43 do_test(a[0].toUpperCase(), a[1]);
44 }
32 }) 45 })
33 </script> 46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698