@haxtheweb/haxcms-nodejs
Version:
HAXcms single and multisite nodejs server, api, and administration
10 lines • 1.66 kB
JavaScript
/**
@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
*/
import"../utils/boot.js";import{resolveUrl as t,pathFromUrl as e}from"../utils/resolve-url.js";import{strictTemplatePolicy as s}from"../utils/settings.js";let o={},r={};function setModule(t,e){o[t]=r[t.toLowerCase()]=e}function findModule(t){return o[t]||r[t.toLowerCase()]}export class DomModule extends HTMLElement{static get observedAttributes(){return["id"]}static import(t,e){if(t){let s=findModule(t);return s&&e?s.querySelector(e):s}return null}attributeChangedCallback(t,e,s,o){e!==s&&this.register()}get assetpath(){if(!this.__assetpath){const s=window.HTMLImports&&HTMLImports.importForElement?HTMLImports.importForElement(this)||document:this.ownerDocument,o=t(this.getAttribute("assetpath")||"",s.baseURI);this.__assetpath=e(o)}return this.__assetpath}register(t){if(t=t||this.id){if(s&&void 0!==findModule(t))throw setModule(t,null),new Error(`strictTemplatePolicy: dom-module ${t} re-registered`);this.id=t,setModule(t,this),function styleOutsideTemplateCheck(t){t.querySelector("style")&&console.warn("dom-module %s has style outside template",t.id)}(this)}}}DomModule.prototype.modules=o,customElements.define("dom-module",DomModule);