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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/leaktests/html-collection.html

Issue 1954153002: Revert of Import web-platform-tests@88b9a65ce806b5f67e0a535bf2f1602c2df6af58 (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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta name='author' title='Google' href='http://www.google.com'> 4 <meta name='author' title='Google' href='http://www.google.com'>
5 <meta name='assert' content='document attributes that returns HTMLCollection sho uld not expose nodes in shadow tree.'> 5 <meta name='assert' content='document attributes that returns HTMLCollection sho uld not expose nodes in shadow tree.'>
6 <link rel='help' href='https://w3c.github.io/webcomponents/spec/shadow/'> 6 <link rel='help' href='https://w3c.github.io/webcomponents/spec/shadow/'>
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 </head> 9 </head>
10 <body> 10 <body>
11 <template id='collection-template'> 11 <template id='collection-template'>
12 <img> 12 <img>
13 <embed></embed> 13 <embed></embed>
14 <plugin></plugin> 14 <plugin></plugin>
15 <applet></applet> 15 <applet></applet>
16 <object type='application/x-java-applet'></object> 16 <object type='application/x-java-applet'></object>
17 <a href='http://example.com'></a> 17 <a href='http://example.com'></a>
18 <a name='test'></a> 18 <a name='test'></a>
19 <form name='test'></form> 19 <form name='test'></form>
20 <script></script> 20 <script></script>
21 </template> 21 </template>
22 <div id='doc'></div> 22 <div id='doc'></div>
23 <div id='host-open'></div> 23 <div id='host'></div>
24 <div id='host-closed'></div>
25 </body> 24 </body>
26 <script> 25 <script>
27 'use strict'; 26 'use strict';
28 27
29 function fillTemplate(root, prefix) { 28 function fillTemplate(root, prefix) {
30 var tmpl = document.getElementById('collection-template'); 29 var tmpl = document.getElementById('collection-template');
31 root.appendChild(document.importNode(tmpl.content, true)); 30 root.appendChild(document.importNode(tmpl.content, true));
32 for (var i = 0; i < root.childNodes.length; ++i) { 31 for (var i = 0; i < root.childNodes.length; ++i) {
33 var el = root.childNodes[i]; 32 var el = root.childNodes[i];
34 if (el.nodeType != 1) 33 if (el.nodeType != 1)
35 continue; 34 continue;
36 el.id = prefix + el.tagName.toLowerCase(); 35 el.id = prefix + el.tagName.toLowerCase();
37 } 36 }
38 } 37 }
39 38
40 // Construct subtree with 'doc-*' ids. 39 // Construct subtree with 'doc-*' ids.
41 var doc = document.getElementById('doc'); 40 var doc = document.getElementById('doc');
42 fillTemplate(doc, 'doc-'); 41 fillTemplate(doc, 'doc-');
43 42
44 // Construct shadow subtree with 'shadow-*' ids. 43 // Construct shadow subtree with 'shadow-*' ids.
45 var host = document.getElementById('host-open'); 44 var host = document.getElementById('host');
46 var shadow = host.attachShadow({mode: 'open'}); 45 var shadow = host.attachShadow({mode: 'open'});
47 fillTemplate(shadow, 'shadow-open-'); 46 fillTemplate(shadow, 'shadow-');
48
49 host = document.getElementById('host-closed');
50 shadow = host.attachShadow({mode: 'closed'});
51 fillTemplate(shadow, 'shadow-closed-');
52 47
53 function testCollection(collection) { 48 function testCollection(collection) {
54 var elements = document[collection]; 49 var elements = document[collection];
55 assert_greater_than(elements.length, 0, 'document.' + collection + ' should have at least 1 element.'); 50 assert_greater_than(elements.length, 0, 'document.' + collection + ' should have at least 1 element.');
56 for (var i = 0; i < elements.length; ++i) { 51 for (var i = 0; i < elements.length; ++i) {
57 if (elements[i].id) { 52 if (elements[i].id) {
58 assert_equals(elements[i].id.indexOf('shadow-'), -1, 'document.' + c ollection + ' should not contain elements in shadow tree.'); 53 assert_equals(elements[i].id.indexOf('shadow-'), -1, 'document.' + c ollection + ' should not contain elements in shadow tree.');
59 } 54 }
60 } 55 }
61 } 56 }
62 57
63 var testParams = [ 58 var testParams = [
64 ['document.scripts should not contain shadow nodes', 'scripts'], 59 ['document.scripts should not contain shadow nodes', 'scripts'],
65 ['document.all should not contain shadow nodes', 'all'], 60 ['document.all should not contain shadow nodes', 'all'],
66 ['document.forms should not contain shadow nodes', 'forms'], 61 ['document.forms should not contain shadow nodes', 'forms'],
67 ['document.images should not contain shadow nodes', 'images'], 62 ['document.images should not contain shadow nodes', 'images'],
68 ['document.links should not contain shadow nodes', 'links'], 63 ['document.links should not contain shadow nodes', 'links'],
69 ['document.anchors should not contain shadow nodes', 'anchors'], 64 ['document.anchors should not contain shadow nodes', 'anchors'],
70 ['document.embeds should not contain shadow nodes', 'embeds'], 65 ['document.embeds should not contain shadow nodes', 'embeds'],
71 ['document.plugins should not contain shadow nodes', 'plugins'], 66 ['document.plugins should not contain shadow nodes', 'plugins'],
72 ['document.applets should not contain shadow nodes', 'applets']]; 67 ['document.applets should not contain shadow nodes', 'applets']];
73 68
74 generate_tests(testCollection, testParams); 69 generate_tests(testCollection, testParams);
75 70
76 </script> 71 </script>
77 </html> 72 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698