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

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

Issue 1984023002: Move web-platform-tests to wpt (part 1 of 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
(Empty)
1 <!DOCTYPE html>
2 <title>Test of interfaces</title>
3 <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
4 <link rel="help" href="https://html.spec.whatwg.org/multipage/">
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">
7 <script src="../../../../resources/testharness.js"></script>
8 <script src="../../../../resources/testharnessreport.js"></script>
9 <script src=interfaces.js></script>
10 <div id="log"></div>
11 <script>
12 function do_test(local_name, iface, variant) {
13 test(function() {
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 }
22 assert_class_string(e, i,
23 "Element " + local_name + " should have " + i +
24 " as its primary interface.");
25 assert_true(e instanceof window[i],
26 "Element " + local_name + " should implement " + i + ".");
27 assert_true(e instanceof HTMLElement,
28 "Element " + local_name + " should implement HTMLElement.");
29 assert_true(e instanceof Element,
30 "Element " + local_name + " should implement Element.");
31 assert_true(e instanceof Node,
32 "Element " + local_name + " should implement Node.");
33 }, "Interfaces for " + local_name);
34 }
35
36 elements.forEach(function(a) {
37 do_test(a[0], a[1], "useNS");
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 }
45 })
46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698