OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 <head> | 4 <head> |
5 <link id="staticImportLink" rel="import" href="resources/hello.html"> | 5 <link id="staticImportLink" rel="import" href="resources/hello.html"> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 description("This tests 'element removed flag' behavior defined in https://dvcs.
w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html#dfn-element-removed
-flag."); | 9 description("This tests 'element removed flag' behavior defined in https://dvcs.
w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html#dfn-element-removed
-flag."); |
10 window.jsTestIsAsync = true; | 10 window.jsTestIsAsync = true; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 dynamicImport.setAttribute("href", "resources/bye.html"); | 42 dynamicImport.setAttribute("href", "resources/bye.html"); |
43 dynamicImport.addEventListener("load", check); | 43 dynamicImport.addEventListener("load", check); |
44 document.head.appendChild(dynamicImport); | 44 document.head.appendChild(dynamicImport); |
45 } | 45 } |
46 | 46 |
47 function testDynamicImportRemovingEagerly() | 47 function testDynamicImportRemovingEagerly() |
48 { | 48 { |
49 dynamicImportEager = document.createElement("link"); | 49 dynamicImportEager = document.createElement("link"); |
50 dynamicImportEager.setAttribute("rel", "import"); | 50 dynamicImportEager.setAttribute("rel", "import"); |
51 dynamicImportEager.setAttribute("href", "resources/setting-greet-var.html"); | 51 dynamicImportEager.setAttribute("href", "resources/setting-greet-var.html"); |
| 52 dynamicImportEager.addEventListener("load", check); |
52 document.head.appendChild(dynamicImportEager); | 53 document.head.appendChild(dynamicImportEager); |
53 | 54 |
54 // Reoving <link> just after appending it. | 55 // Reoving <link> just after appending it. |
55 // This should start import loading, but shouldn't make .import visible. | 56 // This should start import loading, but shouldn't make .import visible. |
56 dynamicImportEager.remove(); | 57 dynamicImportEager.remove(); |
57 | 58 |
58 function check() | 59 function check() |
59 { | 60 { |
60 if (window.greet != "Hello") { | 61 if (window.greet != "Hello") { |
61 window.setTimeout(check, 0); | 62 window.setTimeout(check, 0); |
62 return; | 63 return; |
63 } | 64 } |
64 | 65 |
65 shouldBeNull("dynamicImportEager.import"); | 66 shouldBeNull("dynamicImportEager.import"); |
66 document.head.appendChild(dynamicImportEager); | 67 document.head.appendChild(dynamicImportEager); |
67 shouldBeNonNull("dynamicImportEager.import"); | 68 shouldBeNonNull("dynamicImportEager.import"); |
68 | 69 |
69 window.requestAnimationFrame(function() { finishJSTest(); }, 0); | 70 window.requestAnimationFrame(function() { finishJSTest(); }, 0); |
70 } | 71 } |
71 | 72 |
72 window.setTimeout(check, 0); | 73 window.setTimeout(check, 0); |
73 } | 74 } |
74 | 75 |
75 testStaticImport(); | 76 testStaticImport(); |
76 testDynamicImport(); | 77 testDynamicImport(); |
77 | 78 |
78 </script> | 79 </script> |
79 </body> | 80 </body> |
80 </html> | 81 </html> |
OLD | NEW |