| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <title>Template with HTMLImports Test</title> |
| 14 <script src="../../template/template.js"></script> |
| 15 <script src="../../custom-elements/custom-elements.min.js"></script> |
| 16 <script src="../../web-component-tester/browser.js"></script> |
| 17 </head> |
| 18 <body> |
| 19 <body> |
| 20 |
| 21 <template> |
| 22 <x-child></x-child> |
| 23 </template> |
| 24 |
| 25 <template id="before"></template> |
| 26 <x-after></x-after> |
| 27 |
| 28 <script> |
| 29 var created = []; |
| 30 var attached = []; |
| 31 var childCreated = false; |
| 32 var foundTemplate = false; |
| 33 |
| 34 class XChild extends HTMLElement { |
| 35 constructor() { |
| 36 super(); |
| 37 this.custom = true; |
| 38 childCreated = true; |
| 39 } |
| 40 } |
| 41 |
| 42 class XAfter extends HTMLElement { |
| 43 constructor() { |
| 44 super(); |
| 45 this.custom = true; |
| 46 |
| 47 var template = document.querySelector('#before'); |
| 48 if (template && template.content) { |
| 49 foundTemplate = true; |
| 50 } |
| 51 } |
| 52 } |
| 53 |
| 54 // The template polyfill is asynchronous, so on IE11 we shouldn't |
| 55 // try to upgrade before it's done its thing. |
| 56 document.addEventListener('DOMContentLoaded', function() { |
| 57 window.customElements.define('x-child', XChild); |
| 58 window.customElements.define('x-after', XAfter); |
| 59 }); |
| 60 |
| 61 suite('template and custom elements', function() { |
| 62 test('elements within templates not upgraded', function() { |
| 63 assert(!childCreated); |
| 64 }); |
| 65 |
| 66 test('templates before elements are bootstrapped before createdCallback'
, function() { |
| 67 assert(foundTemplate); |
| 68 }); |
| 69 }); |
| 70 </script> |
| 71 </body> |
| 72 </html> |
| OLD | NEW |