File tree Expand file tree Collapse file tree 5 files changed +12
-14
lines changed
Expand file tree Collapse file tree 5 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -300,9 +300,8 @@ export const ElementMixin = dedupingMixin(base => {
300300 let template = /** @type {PolymerElementConstructor } */ ( this ) . template ;
301301 if ( template ) {
302302 if ( typeof template === 'string' ) {
303- let t = document . createElement ( 'template' ) ;
304- t . innerHTML = template ;
305- template = t ;
303+ console . error ( 'template getter must return HTMLTemplateElement' ) ;
304+ template = null ;
306305 } else {
307306 template = template . cloneNode ( true ) ;
308307 }
Original file line number Diff line number Diff line change 1818< body >
1919
2020< script type ="module ">
21- import { PolymerElement } from '../../polymer-element.js' ;
21+ import { PolymerElement , html } from '../../polymer-element.js' ;
2222class XA extends PolymerElement {
2323 static get template ( ) {
24- return `<x-b prop="[[prop]]"></x-b>` ;
24+ return html `< x-b prop ="[[prop]] "> </ x-b > ` ;
2525 }
2626 static get observers ( ) { return [ 'propChanged(prop)' ] }
2727 propChanged ( ) {
101101
102102class XC extends PolymerElement {
103103 static get template ( ) {
104- return `<div></div>` ;
104+ return html `< div > </ div > ` ;
105105 }
106106 static get observers ( ) { return [ 'propChanged(prop)' ] }
107107 propChanged ( ) {
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ Polymer({
195195 }
196196} ) ;
197197let XNestedRepeat = Polymer ( {
198- _template : `
198+ _template : html `
199199 < template id ="repeater " is ="dom-repeat " items ="{{items}} " as ="itema " index-as ="indexa " on-dom-change ="domUpdateHandler ">
200200 < x-foo on-test1 ="testHandler1 "
201201 innera-prop ="{{innera.prop}} "
@@ -254,8 +254,7 @@ let XNestedRepeat = Polymer({
254254class XNestedRepeatMutable extends MutableData ( XNestedRepeat ) {
255255 static get template ( ) {
256256 if ( ! this . _templateEl ) {
257- this . _templateEl = document . createElement ( 'template' ) ;
258- this . _templateEl . innerHTML = XNestedRepeat . template ;
257+ this . _templateEl = XNestedRepeat . template . cloneNode ( true ) ;
259258 }
260259 return this . makeRepeatsMutable ( this . _templateEl . cloneNode ( true ) ) ;
261260 }
Original file line number Diff line number Diff line change 9999
100100 < dom-module id ="sub-element ">
101101 < script type ="module ">
102- import '../../polymer-element.js' ;
102+ import { PolymerElement } from '../../polymer-element.js' ;
103103
104104class SubElement extends window . MyElement {
105105
247247 </ dom-module >
248248
249249 < script type ="module ">
250- import '../../polymer-element.js' ;
250+ import { html } from '../../polymer-element.js' ;
251251
252252class SubNewTemplate extends window . MyElement {
253253 static get template ( ) {
254- return `
254+ return html `
255255 < h1 > Sub template</ h1 >
256256 < div id ="subContent "> {{prop2}}</ div > ` ;
257257 }
Original file line number Diff line number Diff line change 587587 </ style >
588588</ template >
589589< script type ="module ">
590- import { PolymerElement } from '../../polymer-element.js' ;
590+ import { PolymerElement , html } from '../../polymer-element.js' ;
591591customElements . define ( 'x-class-no-is' , class extends PolymerElement {
592592 static get template ( ) {
593593 return window . xClass ;
596596
597597customElements . define ( 'x-template-string' , class extends PolymerElement {
598598 static get template ( ) {
599- return `<style>
599+ return html `< style >
600600 : host {
601601 dis play: block;
602602 bor der: 1px solid or ange;
You can’t perform that action at this time.
0 commit comments