diff --git a/lib/utils/settings.js b/lib/utils/settings.js index ac52b49610..42040591e5 100644 --- a/lib/utils/settings.js +++ b/lib/utils/settings.js @@ -23,7 +23,8 @@ export const useNativeCustomElements = !(window.customElements.polyfillWrapFlush * `rootPath` to provide a stable application mount path when * using client side routing. */ -export let rootPath = pathFromUrl(document.baseURI || window.location.href); +export let rootPath = window.Polymer && window.Polymer.rootPath || + pathFromUrl(document.baseURI || window.location.href); /** * Sets the global rootPath property used by `ElementMixin` and @@ -51,7 +52,8 @@ export const setRootPath = function(path) { * * @type {(function(*,string,string,Node):*)|undefined} */ -export let sanitizeDOMValue = window.Polymer && window.Polymer.sanitizeDOMValue || undefined; +export let sanitizeDOMValue = + window.Polymer && window.Polymer.sanitizeDOMValue || undefined; /** * Sets the global sanitizeDOMValue available via this module's exported @@ -70,7 +72,8 @@ export const setSanitizeDOMValue = function(newSanitizeDOMValue) { * scrolling performance. * Defaults to `false` for backwards compatibility. */ -export let passiveTouchGestures = false; +export let passiveTouchGestures = + window.Polymer && window.Polymer.setPassiveTouchGestures || false; /** * Sets `passiveTouchGestures` globally for all elements using Polymer Gestures. @@ -88,7 +91,8 @@ export const setPassiveTouchGestures = function(usePassive) { * disallowed, `` is disabled, and ``/`` * templates will only evaluate in the context of a trusted element template. */ -export let strictTemplatePolicy = false; +export let strictTemplatePolicy = + window.Polymer && window.Polymer.strictTemplatePolicy || false; /** * Sets `strictTemplatePolicy` globally for all elements @@ -107,7 +111,8 @@ export const setStrictTemplatePolicy = function(useStrictPolicy) { * getter and the `html` tag function. To enable legacy loading of templates * via dom-module, set this flag to true. */ -export let allowTemplateFromDomModule = false; +export let allowTemplateFromDomModule = + window.Polymer && window.Polymer.allowTemplateFromDomModule || false; /** * Sets `lookupTemplateFromDomModule` globally for all elements @@ -127,7 +132,8 @@ export const setAllowTemplateFromDomModule = function(allowDomModule) { * If no includes or relative urls are used in styles, these steps can be * skipped as an optimization. */ -export let legacyOptimizations = window.Polymer && window.Polymer.legacyOptimizations || false; +export let legacyOptimizations = + window.Polymer && window.Polymer.legacyOptimizations || false; /** * Sets `legacyOptimizations` globally for all elements to enable optimizations @@ -144,7 +150,8 @@ export const setLegacyOptimizations = function(useLegacyOptimizations) { /** * Setting to add warnings useful when migrating from Polymer 1.x to 2.x. */ -export let legacyWarnings = false; +export let legacyWarnings = + window.Polymer && window.Polymer.legacyWarnings || false; /** * Sets `legacyWarnings` globally for all elements to migration warnings. @@ -160,7 +167,8 @@ export const setLegacyWarnings = function(useLegacyWarnings) { * Setting to perform initial rendering synchronously when running under ShadyDOM. * This matches the behavior of Polymer 1. */ -export let syncInitialRender = false; +export let syncInitialRender = + window.Polymer && window.Polymer.syncInitialRender || false; /** * Sets `syncInitialRender` globally for all elements to enable synchronous @@ -179,7 +187,8 @@ export const setSyncInitialRender = function(useSyncInitialRender) { * observers around undefined values. Observers and computed property methods * are not called until no argument is undefined. */ -export let legacyUndefined = false; +export let legacyUndefined = + window.Polymer && window.Polymer.legacyUndefined || false; /** * Sets `legacyUndefined` globally for all elements to enable legacy @@ -197,7 +206,8 @@ export const setLegacyUndefined = function(useLegacyUndefined) { * Setting to retain the legacy Polymer 1 behavior for setting properties. Does * not batch property sets. */ -export let legacyNoBatch = false; +export let legacyNoBatch = + window.Polymer && window.Polymer.legacyNoBatch || false; /** * Sets `legacyNoBatch` globally for all elements to enable legacy @@ -216,7 +226,8 @@ export const setLegacyNoBatch = function(useLegacyNoBatch) { * fire change events with respect to other effects. In Polymer 1.x they fire * before observers; in 2.x they fire after all other effect types. */ -export let legacyNotifyOrder = false; +export let legacyNotifyOrder = + window.Polymer && window.Polymer.legacyNotifyOrder || false; /** * Sets `legacyNotifyOrder` globally for all elements to enable legacy @@ -233,7 +244,8 @@ export const setLegacyNotifyOrder = function(useLegacyNotifyOrder) { * Setting to ensure computed properties are computed in order to ensure * re-computation never occurs in a given turn. */ -export let orderedComputed = false; +export let orderedComputed = + window.Polymer && window.Polymer.orderedComputed || false; /** * Sets `orderedComputed` globally for all elements to enable ordered computed @@ -270,7 +282,8 @@ export const setCancelSyntheticClickEvents = function(useCancelSyntheticClickEve * eliminates most of the tax of needing two elements due to the loss of * type-extended templates as a result of the V1 specification changes. */ -export let removeNestedTemplates = false; +export let removeNestedTemplates = + window.Polymer && window.Polymer.removeNestedTemplates || false; /** * Sets `removeNestedTemplates` globally, to eliminate nested templates @@ -292,7 +305,7 @@ export const setRemoveNestedTemplates = function(useCemoveNestedTemplates) { * such as `modelForElement` will not be available for nodes stamped by * `dom-if`. */ -export let fastDomIf = false; +export let fastDomIf = window.Polymer && window.Polymer.fastDomIf || false; /** * Sets `fastDomIf` globally, to put `dom-if` in a performance-optimized mode.