| 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 22 matching lines...) Expand all Loading... |
| 33 shouldBeNull("dynamicImport.import"); | 33 shouldBeNull("dynamicImport.import"); |
| 34 document.head.appendChild(dynamicImport); | 34 document.head.appendChild(dynamicImport); |
| 35 shouldBeNonNull("dynamicImport.import"); | 35 shouldBeNonNull("dynamicImport.import"); |
| 36 | 36 |
| 37 testDynamicImportRemovingEagerly(); | 37 testDynamicImportRemovingEagerly(); |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 dynamicImport = document.createElement("link"); | 40 dynamicImport = document.createElement("link"); |
| 41 dynamicImport.setAttribute("rel", "import"); | 41 dynamicImport.setAttribute("rel", "import"); |
| 42 dynamicImport.setAttribute("href", "resources/bye.html"); | 42 dynamicImport.setAttribute("href", "resources/bye.html"); |
| 43 dynamicImport.addEventListener("load", check); | |
| 44 document.head.appendChild(dynamicImport); | 43 document.head.appendChild(dynamicImport); |
| 45 } | 44 } |
| 46 | 45 |
| 47 function testDynamicImportRemovingEagerly() | 46 function testDynamicImportRemovingEagerly() |
| 48 { | 47 { |
| 49 dynamicImportEager = document.createElement("link"); | 48 dynamicImportEager = document.createElement("link"); |
| 50 dynamicImportEager.setAttribute("rel", "import"); | 49 dynamicImportEager.setAttribute("rel", "import"); |
| 51 dynamicImportEager.setAttribute("href", "resources/setting-greet-var.html"); | 50 dynamicImportEager.setAttribute("href", "resources/setting-greet-var.html"); |
| 52 dynamicImportEager.addEventListener("load", check); | |
| 53 document.head.appendChild(dynamicImportEager); | 51 document.head.appendChild(dynamicImportEager); |
| 54 | 52 |
| 55 // Reoving <link> just after appending it. | 53 // Reoving <link> just after appending it. |
| 56 // This should start import loading, but shouldn't make .import visible. | 54 // This should start import loading, but shouldn't make .import visible. |
| 57 dynamicImportEager.remove(); | 55 dynamicImportEager.remove(); |
| 58 | 56 |
| 59 function check() | 57 function check() |
| 60 { | 58 { |
| 61 if (window.greet != "Hello") { | 59 if (window.greet != "Hello") { |
| 62 window.setTimeout(check, 0); | 60 window.setTimeout(check, 0); |
| 63 return; | 61 return; |
| 64 } | 62 } |
| 65 | 63 |
| 66 shouldBeNull("dynamicImportEager.import"); | 64 shouldBeNull("dynamicImportEager.import"); |
| 67 document.head.appendChild(dynamicImportEager); | 65 document.head.appendChild(dynamicImportEager); |
| 68 shouldBeNonNull("dynamicImportEager.import"); | 66 shouldBeNonNull("dynamicImportEager.import"); |
| 69 | 67 |
| 70 window.requestAnimationFrame(function() { finishJSTest(); }, 0); | 68 window.requestAnimationFrame(function() { finishJSTest(); }, 0); |
| 71 } | 69 } |
| 72 | 70 |
| 73 window.setTimeout(check, 0); | 71 window.setTimeout(check, 0); |
| 74 } | 72 } |
| 75 | 73 |
| 76 testStaticImport(); | 74 testStaticImport(); |
| 77 testDynamicImport(); | 75 testDynamicImport(); |
| 78 | 76 |
| 79 </script> | 77 </script> |
| 80 </body> | 78 </body> |
| 81 </html> | 79 </html> |
| OLD | NEW |