-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lib/utils/settings.html to hold legacy settings and rootPath
- Loading branch information
1 parent
3380c78
commit 3183e3f
Showing
3 changed files
with
66 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- | ||
@license | ||
Copyright (c) 2017 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
|
||
<link rel="import" href="../utils/boot.html"> | ||
<link rel="import" href="../utils/resolve-url.html"> | ||
|
||
<script> | ||
(function() { | ||
'use strict'; | ||
|
||
/** | ||
* Legacy settings. | ||
* @namespace | ||
* @memberof Polymer | ||
*/ | ||
const settings = Polymer.Settings || {}; | ||
settings.useShadow = !(window.ShadyDOM); | ||
settings.useNativeCSSProperties = | ||
Boolean(!window.ShadyCSS || window.ShadyCSS.nativeCss); | ||
settings.useNativeCustomElements = | ||
!(window.customElements.polyfillWrapFlushCallback); | ||
|
||
/** | ||
* Sets the global, legacy settings. | ||
* | ||
* @deprecated | ||
* @memberof Polymer | ||
*/ | ||
Polymer.Settings = settings; | ||
|
||
/** | ||
* Globally settable property that is automatically assigned to | ||
* `Polymer.ElementMixin` instances, useful for binding in templates to | ||
* make URL's relative to an application's root. Defaults to the main | ||
* document URL, but can be overridden by users. It may be useful to set | ||
* `Polymer.rootPath` to provide a stable application mount path when | ||
* using client side routing. | ||
* | ||
* @memberof Polymer | ||
*/ | ||
let rootPath = Polymer.rootPath || | ||
Polymer.ResolveUrl.pathFromUrl(document.baseURI || window.location.href); | ||
|
||
Polymer.rootPath = rootPath; | ||
|
||
/** | ||
* Sets the global rootPath property used by `Polymer.ElementMixin` and | ||
* available via `Polymer.rootPath`. | ||
* | ||
* @memberof Polymer | ||
* @param {string} path The new root path | ||
*/ | ||
Polymer.setRootPath = function(path) { | ||
Polymer.rootPath = path; | ||
} | ||
})(); | ||
</script> |