File tree Expand file tree Collapse file tree 4 files changed +21
-8
lines changed
Expand file tree Collapse file tree 4 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 7979 * @memberof Polymer
8080 */
8181 Polymer . DirMixin = Polymer . dedupingMixin ( ( base ) => {
82- return base ;
8382
8483 if ( ! observer ) {
8584 getRTL ( ) ;
Original file line number Diff line number Diff line change 314314 let t = document . createElement ( 'template' ) ;
315315 t . innerHTML = template ;
316316 template = t ;
317- // } else {
318- // template = template.cloneNode(true);
317+ } else if ( ! Polymer . legacyOptimizations ) {
318+ template = template . cloneNode ( true ) ;
319319 }
320320 }
321321
409409 * The `importPath` property is also set on element instances and can be
410410 * used to create bindings relative to the import path.
411411 *
412- * For elements defined in ES modules, users should implement
412+ * For elements defined in ES modules, users should implement
413413 * `static get importMeta() { return import.meta; }`, and the default
414414 * implementation of `importPath` will return `import.meta.url`'s path.
415415 * For elements defined in HTML imports, this getter will return the path
428428 this . _importPath = Polymer . ResolveUrl . pathFromUrl ( meta . url ) ;
429429 } else {
430430 const module = Polymer . DomModule && Polymer . DomModule . import ( /** @type {PolymerElementConstructor } */ ( this ) . is ) ;
431- this . _importPath = ( module && module . assetpath ) ||
431+ this . _importPath = ( module && module . assetpath ) ||
432432 Object . getPrototypeOf ( /** @type {PolymerElementConstructor }*/ ( this ) . prototype ) . constructor . importPath ;
433433 }
434434 }
Original file line number Diff line number Diff line change 203203 if ( ! template . _templateInfo ) {
204204 let templateInfo = template . _templateInfo = { } ;
205205 templateInfo . nodeInfoList = [ ] ;
206- templateInfo . stripWhiteSpace = true ;
207- // (outerTemplateInfo && outerTemplateInfo.stripWhiteSpace) ||
208- // template.hasAttribute('strip-whitespace');
206+ templateInfo . stripWhiteSpace = Polymer . legacyOptimizations ||
207+ ( outerTemplateInfo && outerTemplateInfo . stripWhiteSpace ) ||
208+ template . hasAttribute ( 'strip-whitespace' ) ;
209209 this . _parseTemplateContent ( template , templateInfo , { parent : null } ) ;
210210 }
211211 return template . _templateInfo ;
Original file line number Diff line number Diff line change 114114 Polymer . setPassiveTouchGestures = function ( usePassive ) {
115115 Polymer . passiveTouchGestures = usePassive ;
116116 } ;
117+
118+ let legacyOptimizations = false ;
119+ Polymer . legacyOptimizations = legacyOptimizations ;
120+ /**
121+ * Sets `legacyOptimizations` globally for all elements. Enables
122+ * optimizations when only legacy Polymer() style elements are used.
123+ *
124+ * @memberof Polymer
125+ * @param {boolean } useLegacyOptimizations enable or disable legacy optimizations globally.
126+ * @return {void }
127+ */
128+ Polymer . setLegacyOptimizations = function ( useLegacyOptimizations ) {
129+ Polymer . legacyOptimizations = useLegacyOptimizations ;
130+ } ;
117131} ) ( ) ;
118132</ script >
You can’t perform that action at this time.
0 commit comments