forked from webcomponents/custom-elements
-
Notifications
You must be signed in to change notification settings - Fork 1
/
custom-elements.min.js.map
1 lines (1 loc) · 40.7 KB
/
custom-elements.min.js.map
1
{"version":3,"sources":["src/custom-elements.js"],"names":["constructor","CustomElementRegistry","_definitions","Map","_constructors","_whenDefinedMap","_observers","Set","_attributeObserver","MutationObserver","_handleAttributeChange","bind","_newInstance","_pendingHtmlImportUrls","enableFlush","_upgradeScheduled","_mainDocumentObserver","_customElements","win","checkValidCustomElementName","name","test","reservedTagList","indexOf","Error","_createElement","doc","tagName","options","callConstructor","customElements","element","_origCreateElement","call","definition","get","toLowerCase","_upgradeElement","_observeRoot","changeAttribute","value","operation","oldValue","getAttribute","localName","observedAttributes","attributeChangedCallback","newValue","document","window","flush","forcePolyfill","define","getCallback","callbackName","callback","prototype","undefined","TypeError","nameError","has","connectedCallback","disconnectedCallback","set","_upgradeDoc","deferred","resolve","delete","def","whenDefined","Promise","reject","promise","_resolve","_handleMutations","takeRecords","forEach","observer","onReady","_addNodes","childNodes","_setNewInstance","instance","root","observe","childList","subtree","add","_unobserveRoot","disconnect","mutations","i","length","mutation","type","removedNodes","addedNodes","_removeNodes","nodeList","visitedNodes","nodeType","Node","ELEMENT_NODE","walker","createTreeWalker","NodeFilter","SHOW_ELEMENT","_addElement","currentNode","nextNode","n","DOCUMENT_NODE","parentNode","DOCUMENT_FRAGMENT_NODE","host","shadowRoot","rel","split","_addImport","link","_import","import","importUrl","href","_this","onLoad","removeEventListener","addEventListener","node","__proto__","console","assert","attributes","attributeOldValue","attributeFilter","hasAttribute","target","attributeName","attributeNamespace","origHTMLElement","HTMLElement","newHTMLElement","createElement","doc.createElement","_origCreateElementNS","createElementNS","namespaceURI","qualifiedName","_origAttachShadow","Element","Object","defineProperty","rawImportNode","importNode","doc.importNode","deep","clone","nodes","_origSetAttribute","setAttribute","_origRemoveAttribute","removeAttribute","configurable","enumerable"],"mappings":"A;;;;;;;;;aAiCC,SAAQ,EAAG,CA0GRA,QAFIC,E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C,CADwD,CAG1D,KAAME,EAAuBX,OAAA7F,UAAAyG,gBAC7BZ,QAAA7F,UAAA,gBAAA,CAAuC,QAAQ,CAACpC,CAAD,CAAO,CACpDmB,CAAA,CAAgB,IAAhB;AAAsBnB,CAAtB,CAA4B,IAA5B,CAAkC4I,CAAlC,CADoD,CAuBtDV,OAAAC,eAAA,CAAsBtG,MAAtB,CAA8B,gBAA9B,CAAgD,CAC9CT,MAAO,IAAIvC,CADmC,CAE9CiK,aAAc,CAAA,CAFgC,CAG9CC,WAAY,CAAA,CAHkC,CAAhD,CAOAlH,OAAA,eAAA,CAA2B,CACzB0B,YAAAA,QAAW,EAAG,CACR1D,CAAA,EAAAiC,EAAJ,EAA6BjC,CAAA,EAAAiC,EAAA,EADjB,CADW,CA3vBjB,CAAX,CAAD","file":"custom-elements.min.js","sourcesContent":["/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * 2.3\n * http://w3c.github.io/webcomponents/spec/custom/#dfn-element-definition\n * @typedef {{\n * name: string,\n * localName: string,\n * constructor: function(new:HTMLElement),\n * connectedCallback: (Function|undefined),\n * disconnectedCallback: (Function|undefined),\n * attributeChangedCallback: (Function|undefined),\n * observedAttributes: Array<string>,\n * }}\n */\nlet CustomElementDefinition;\n\n/**\n * @typedef {{\n * resolve: !function(undefined),\n * promise: !Promise<undefined>,\n * }}\n */\nlet Deferred;\n\n(function() {\n 'use strict';\n\n const doc = document;\n const win = window;\n\n /**\n * Gets 'customElement' from window so that it could be modified after\n * the polyfill loads.\n * @function\n * @return {CustomElementRegistry}\n */\n const _customElements = () => win['customElements'];\n\n const _observerProp = '__$CE_observer';\n const _attachedProp = '__$CE_attached';\n const _upgradedProp = '__$CE_upgraded';\n\n if (_customElements()) {\n _customElements().flush = function() {};\n if (!_customElements().forcePolyfill) {\n return;\n }\n }\n\n // name validation\n // https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element-name\n\n /**\n * @const\n * @type {Array<string>}\n */\n const reservedTagList = [\n 'annotation-xml',\n 'color-profile',\n 'font-face',\n 'font-face-src',\n 'font-face-uri',\n 'font-face-format',\n 'font-face-name',\n 'missing-glyph',\n ];\n\n /**\n * @param {!string} name\n * @return {!Error|undefined}\n */\n function checkValidCustomElementName(name) {\n if (!(/^[a-z][.0-9_a-z]*-[\\-.0-9_a-z]*$/.test(name) &&\n reservedTagList.indexOf(name) === -1)) {\n return new Error(`The element name '${name}' is not valid.`)\n }\n }\n\n /**\n * @param {!Node} root\n * @return {TreeWalker}\n */\n function createTreeWalker(root) {\n // IE 11 requires the third and fourth arguments be present. If the third\n // arg is null, it applies the default behaviour. However IE also requires\n // the fourth argument be present even though the other browsers ignore it.\n return doc.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, null, false);\n }\n\n /**\n * @param {!Node} node\n * @return {boolean}\n */\n function isElement(node) {\n return node.nodeType === Node.ELEMENT_NODE;\n }\n\n /**\n * @param {!Element} element\n * @return {boolean}\n */\n function isHtmlImport(element) {\n return element.tagName === 'LINK' &&\n element.rel &&\n element.rel.toLowerCase().split(' ').indexOf('import') !== -1;\n }\n\n /**\n * @param {!Element} element\n * @return {boolean}\n */\n function isConnected(element) {\n let n = element;\n do {\n if (n[_attachedProp] || n.nodeType === Node.DOCUMENT_NODE) return true;\n n = n.parentNode || n.nodeType === Node.DOCUMENT_FRAGMENT_NODE && n.host;\n } while(n);\n return false;\n }\n\n /**\n * A registry of custom element definitions.\n *\n * See https://html.spec.whatwg.org/multipage/scripting.html#customelementsregistry\n *\n * @property {boolean} enableFlush Set to true to enable the flush() method\n * to work. This should only be done for tests, as it causes a memory leak.\n */\n class CustomElementRegistry {\n\n constructor() {\n /** @private {!Map<string, !CustomElementDefinition>} **/\n this._definitions = new Map();\n\n /** @private {!Map<Function, string>} **/\n this._constructors = new Map();\n\n /** @private {!Map<string, !Deferred>} **/\n this._whenDefinedMap = new Map();\n\n /** @private {!Set<!MutationObserver>} **/\n this._observers = new Set();\n\n /** @private {!MutationObserver} **/\n this._attributeObserver = new MutationObserver(\n /** @type {function(Array<MutationRecord>, MutationObserver)} */\n (this._handleAttributeChange.bind(this)));\n\n /** @private {?HTMLElement} **/\n this._newInstance = null;\n\n /** @private {!Set<string>} **/\n this._pendingHtmlImportUrls = new Set();\n\n /** @type {boolean} **/\n this.enableFlush = true;\n\n /** @private {boolean} **/\n this._upgradeScheduled = false;\n\n /** @type {MutationObserver} **/\n this._mainDocumentObserver = null;\n }\n\n // HTML spec part 4.13.4\n // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregistry-define\n /**\n * @param {string} name\n * @param {function(new:HTMLElement)} constructor\n * @param {{extends: string}} options\n * @return {undefined}\n */\n define(name, constructor, options) {\n // 1:\n if (typeof constructor !== 'function') {\n throw new TypeError('constructor must be a Constructor');\n }\n\n // 2. If constructor is an interface object whose corresponding interface\n // either is HTMLElement or has HTMLElement in its set of inherited\n // interfaces, throw a TypeError and abort these steps.\n //\n // It doesn't appear possible to check this condition from script\n\n // 3:\n const nameError = checkValidCustomElementName(name);\n if (nameError) throw nameError;\n\n // 4, 5:\n // Note: we don't track being-defined names and constructors because\n // define() isn't normally reentrant. The only time user code can run\n // during define() is when getting callbacks off the prototype, which\n // would be highly-unusual. We can make define() reentrant-safe if needed.\n if (this._definitions.has(name)) {\n throw new Error(`An element with name '${name}' is already defined`);\n }\n\n // 6, 7:\n if (this._constructors.has(constructor)) {\n throw new Error(`Definition failed for '${name}': ` +\n `The constructor is already used.`);\n }\n\n // 8:\n /** @type {string} */\n const localName = name;\n\n // 9, 10: We do not support extends currently.\n\n // 11, 12, 13: Our define() isn't rentrant-safe\n\n // 14.1:\n /** @type {Object} */\n const prototype = constructor.prototype;\n\n // 14.2:\n if (typeof prototype !== 'object') {\n throw new TypeError(`Definition failed for '${name}': ` +\n `constructor.prototype must be an object`);\n }\n\n /**\n * @param {string} callbackName\n * @return {Function|undefined}\n */\n function getCallback(callbackName) {\n const callback = prototype[callbackName];\n if (callback !== undefined && typeof callback !== 'function') {\n throw new Error(`${localName} '${callbackName}' is not a Function`);\n }\n return callback;\n }\n\n // 3, 4:\n const connectedCallback = getCallback('connectedCallback');\n\n // 5, 6:\n const disconnectedCallback = getCallback('disconnectedCallback');\n\n // Divergence from spec: we always throw if attributeChangedCallback is\n // not a function.\n\n // 7, 9.1:\n const attributeChangedCallback = getCallback('attributeChangedCallback');\n\n // 8, 9.2, 9.3:\n const observedAttributes =\n (attributeChangedCallback && constructor['observedAttributes']) || [];\n\n // 15:\n /** @type {CustomElementDefinition} */\n const definition = {\n name: name,\n localName: localName,\n constructor: constructor,\n connectedCallback: connectedCallback,\n disconnectedCallback: disconnectedCallback,\n attributeChangedCallback: attributeChangedCallback,\n observedAttributes: observedAttributes,\n };\n\n // 16:\n this._definitions.set(localName, definition);\n this._constructors.set(constructor, localName);\n\n // 17, 18, 19:\n this._upgradeDoc();\n\n // 20:\n /** @type {Deferred} **/\n const deferred = this._whenDefinedMap.get(localName);\n if (deferred) {\n deferred.resolve(undefined);\n this._whenDefinedMap.delete(localName);\n }\n }\n\n /**\n * Returns the constructor defined for `name`, or `null`.\n *\n * @param {string} name\n * @return {Function|undefined}\n */\n get(name) {\n // https://html.spec.whatwg.org/multipage/scripting.html#custom-elements-api\n const def = this._definitions.get(name);\n return def ? def.constructor : undefined;\n }\n\n /**\n * Returns a `Promise` that resolves when a custom element for `name` has\n * been defined.\n *\n * @param {string} name\n * @return {!Promise}\n */\n whenDefined(name) {\n // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregistry-whendefined\n const nameError = checkValidCustomElementName(name);\n if (nameError) return Promise.reject(nameError);\n if (this._definitions.has(name)) return Promise.resolve();\n\n /** @type {Deferred} **/\n let deferred = this._whenDefinedMap.get(name);\n if (deferred) return deferred.promise;\n\n let resolve;\n const promise = new Promise(function(_resolve, _) {\n resolve = _resolve;\n });\n deferred = {promise, resolve};\n this._whenDefinedMap.set(name, deferred);\n return promise;\n }\n\n /**\n * Causes all pending mutation records to be processed, and thus all\n * customization, upgrades and custom element reactions to be called.\n * `enableFlush` must be true for this to work. Only use during tests!\n */\n flush() {\n if (this.enableFlush) {\n // console.warn(\"flush!!!\");\n this._handleMutations(this._mainDocumentObserver.takeRecords());\n this._handleAttributeChange(this._attributeObserver.takeRecords());\n this._observers.forEach(\n /**\n * @param {!MutationObserver} observer\n * @this {CustomElementRegistry}\n */\n function(observer) {\n this._handleMutations(observer.takeRecords());\n }, this);\n }\n }\n\n /**\n * Upgrade all existing in document elements. This process is expensive so\n * is optionally batched based on the state of HTMLImports. (Note,\n * this batching might not be necessary if instead of walking the dom,\n * a map of upgrade candidates was maintained.)\n * @private\n */\n _upgradeDoc() {\n if (!this._upgradeScheduled) {\n this._upgradeScheduled = true;\n const onReady = () => {\n this._upgradeScheduled = false;\n if (!this._mainDocumentObserver) {\n this._mainDocumentObserver = this._observeRoot(doc);\n }\n this._addNodes(doc.childNodes);\n\n };\n if (window['HTMLImports']) {\n window['HTMLImports']['whenReady'](onReady);\n } else {\n onReady();\n }\n }\n }\n\n /**\n * @param {?HTMLElement} instance\n * @private\n */\n _setNewInstance(instance) {\n this._newInstance = instance;\n }\n\n /**\n * Observes a DOM root for mutations that trigger upgrades and reactions.\n * @param {Node} root\n * @private\n */\n _observeRoot(root) {\n //console.log('_observeRoot', root, root.baseURI);\n // console.assert(!root[_observerProp]);\n if (root[_observerProp] != null) {\n //console.warn(`Root ${root} is already observed`);\n return root[_observerProp];\n }\n root[_observerProp] = new MutationObserver(\n /** @type {function(Array<MutationRecord>, MutationObserver)} */\n (this._handleMutations.bind(this)));\n root[_observerProp].observe(root, {childList: true, subtree: true});\n if (this.enableFlush) {\n // this is memory leak, only use in tests\n this._observers.add(root[_observerProp]);\n }\n return root[_observerProp];\n }\n\n /**\n * @param {Node} root\n * @private\n */\n _unobserveRoot(root) {\n if (root[_observerProp] != null) {\n root[_observerProp].disconnect();\n if (this.enableFlush) {\n this._observers.delete(root[_observerProp]);\n }\n root[_observerProp] = null;\n }\n }\n\n /**\n * @param {!Array<!MutationRecord>} mutations\n * @private\n */\n _handleMutations(mutations) {\n for (let i = 0; i < mutations.length; i++) {\n /** @type {!MutationRecord} */\n const mutation = mutations[i];\n if (mutation.type === 'childList') {\n // Note: we can't get an ordering between additions and removals, and\n // so might diverge from spec reaction ordering\n const addedNodes = /** @type {!NodeList<!Node>} */(mutation.addedNodes);\n const removedNodes = /** @type {!NodeList<!Node>} */(mutation.removedNodes);\n this._addNodes(addedNodes);\n this._removeNodes(removedNodes);\n }\n }\n }\n\n /**\n * @param {!(NodeList<!Node>|Array<!Node>)} nodeList\n * @param {?Set<Node>=} visitedNodes\n * @private\n */\n _addNodes(nodeList, visitedNodes) {\n visitedNodes = visitedNodes || new Set();\n\n for (let i = 0; i < nodeList.length; i++) {\n const root = nodeList[i];\n\n if (!isElement(root)) {\n continue;\n }\n\n // Since we're adding this node to an observed tree, we can unobserve\n this._unobserveRoot(root);\n\n const walker = createTreeWalker(root);\n do {\n const node = /** @type {!HTMLElement} */ (walker.currentNode);\n this._addElement(node, visitedNodes);\n } while (walker.nextNode())\n }\n }\n\n /**\n * @param {!HTMLElement} element\n * @param {!Set<Node>=} visitedNodes\n */\n _addElement(element, visitedNodes) {\n if (visitedNodes.has(element)) return;\n visitedNodes.add(element);\n\n /** @type {?CustomElementDefinition} */\n const definition = this._definitions.get(element.localName);\n if (definition) {\n if (!element[_upgradedProp]) {\n this._upgradeElement(element, definition, true);\n }\n if (element[_upgradedProp] && !element[_attachedProp] && isConnected(element)) {\n element[_attachedProp] = true;\n if (definition.connectedCallback) {\n definition.connectedCallback.call(element);\n }\n }\n }\n if (element.shadowRoot) {\n // TODO(justinfagnani): do we need to check that the shadowRoot\n // is observed?\n this._addNodes(element.shadowRoot.childNodes, visitedNodes);\n }\n if (isHtmlImport(element)) {\n this._addImport(/** @type {!HTMLLinkElement} */(element), visitedNodes);\n }\n }\n\n /**\n * @param {!HTMLLinkElement} link\n * @param {!Set<Node>=} visitedNodes\n */\n _addImport(link, visitedNodes) {\n // During a tree walk to add or upgrade nodes, we may encounter multiple\n // HTML imports that reference the same document, and may encounter\n // imports in various states of loading.\n\n // First, we only want to process the first import for a document in a\n // walk, so we check visitedNodes for the document, not the link.\n //\n // Second, for documents that haven't loaded yet, we only want to add one\n // listener, regardless of the number of links or walks, so we track\n // pending loads in _pendingHtmlImportUrls.\n\n // Check to see if the import is loaded\n /** @type {?Document} */\n const _import = link.import;\n if (_import) {\n // The import is loaded, but only process the first link element\n if (visitedNodes.has(_import)) return;\n visitedNodes.add(_import);\n\n // The import is loaded observe it\n if (!_import[_observerProp]) this._observeRoot(_import);\n\n // walk the document\n this._addNodes(_import.childNodes, visitedNodes);\n } else {\n // The import is not loaded, so wait for it\n /** @type {string} */\n const importUrl = link.href;\n if (this._pendingHtmlImportUrls.has(importUrl)) return;\n this._pendingHtmlImportUrls.add(importUrl);\n\n /**\n * @const\n * @type {CustomElementRegistry}\n */\n const _this = this;\n const onLoad = function() {\n link.removeEventListener('load', /** @type {function(Event)} */(onLoad));\n if (!link.import[_observerProp]) _this._observeRoot(link.import);\n // We don't pass visitedNodes because this is async and not part of\n // the current tree walk.\n _this._addNodes(link.import.childNodes);\n };\n link.addEventListener('load', onLoad);\n }\n }\n\n /**\n * @param {NodeList} nodeList\n * @private\n */\n _removeNodes(nodeList) {\n for (let i = 0; i < nodeList.length; i++) {\n const root = nodeList[i];\n\n if (!isElement(root)) {\n continue;\n }\n\n // Since we're detatching this element from an observed root, we need to\n // reobserve it.\n // TODO(justinfagnani): can we do this in a microtask so we don't thrash\n // on creating and destroying MutationObservers on batch DOM mutations?\n this._observeRoot(root);\n\n const walker = createTreeWalker(root);\n do {\n const node = walker.currentNode;\n if (node[_upgradedProp] && node[_attachedProp]) {\n node[_attachedProp] = false;\n const definition = this._definitions.get(node.localName);\n if (definition && definition.disconnectedCallback) {\n definition.disconnectedCallback.call(node);\n }\n }\n } while (walker.nextNode())\n }\n }\n\n /**\n * Upgrades or customizes a custom element.\n *\n * @param {HTMLElement} element\n * @param {CustomElementDefinition} definition\n * @param {boolean} callConstructor\n * @private\n */\n _upgradeElement(element, definition, callConstructor) {\n const prototype = definition.constructor.prototype;\n element.__proto__ = prototype;\n if (callConstructor) {\n this._setNewInstance(element);\n new (definition.constructor)();\n element[_upgradedProp] = true;\n console.assert(this._newInstance == null);\n }\n\n const observedAttributes = definition.observedAttributes;\n const attributeChangedCallback = definition.attributeChangedCallback;\n if (attributeChangedCallback && observedAttributes.length > 0) {\n this._attributeObserver.observe(element, {\n attributes: true,\n attributeOldValue: true,\n attributeFilter: observedAttributes,\n });\n\n // Trigger attributeChangedCallback for existing attributes.\n // https://html.spec.whatwg.org/multipage/scripting.html#upgrades\n for (let i = 0; i < observedAttributes.length; i++) {\n const name = observedAttributes[i];\n if (element.hasAttribute(name)) {\n const value = element.getAttribute(name);\n attributeChangedCallback.call(element, name, null, value, null);\n }\n }\n }\n }\n\n /**\n * @param {!Array<!MutationRecord>} mutations\n * @private\n */\n _handleAttributeChange(mutations) {\n for (let i = 0; i < mutations.length; i++) {\n const mutation = mutations[i];\n if (mutation.type === 'attributes') {\n const target = /** @type {HTMLElement} */(mutation.target);\n // We should be gaurenteed to have a definition because this mutation\n // observer is only observing custom elements observedAttributes\n const definition = this._definitions.get(target.localName);\n const name = /** @type {!string} */(mutation.attributeName);\n const oldValue = mutation.oldValue;\n const newValue = target.getAttribute(name);\n // Skip changes that were handled synchronously by setAttribute\n if (newValue !== oldValue) {\n const namespace = mutation.attributeNamespace;\n definition.attributeChangedCallback.call(target, name, oldValue, newValue, namespace);\n }\n }\n }\n }\n }\n\n // Closure Compiler Exports\n window['CustomElementRegistry'] = CustomElementRegistry;\n CustomElementRegistry.prototype['define'] = CustomElementRegistry.prototype.define;\n CustomElementRegistry.prototype['get'] = CustomElementRegistry.prototype.get;\n CustomElementRegistry.prototype['whenDefined'] = CustomElementRegistry.prototype.whenDefined;\n CustomElementRegistry.prototype['flush'] = CustomElementRegistry.prototype.flush;\n CustomElementRegistry.prototype['polyfilled'] = true;\n // TODO(justinfagnani): remove these in production code\n CustomElementRegistry.prototype['_observeRoot'] = CustomElementRegistry.prototype._observeRoot;\n CustomElementRegistry.prototype['_addImport'] = CustomElementRegistry.prototype._addImport;\n\n // patch window.HTMLElement\n\n /** @const */\n const origHTMLElement = win.HTMLElement;\n CustomElementRegistry.prototype['nativeHTMLElement'] = origHTMLElement;\n /**\n * @type {function(new: HTMLElement)}\n */\n const newHTMLElement = function HTMLElement() {\n const customElements = _customElements();\n\n // If there's an being upgraded, return that\n if (customElements._newInstance) {\n const i = customElements._newInstance;\n customElements._newInstance = null;\n return i;\n }\n if (this.constructor) {\n // Find the tagname of the constructor and create a new element with it\n const tagName = customElements._constructors.get(this.constructor);\n return _createElement(doc, tagName, undefined, false);\n }\n throw new Error('Unknown constructor. Did you call customElements.define()?');\n }\n win.HTMLElement = newHTMLElement;\n // By setting the patched HTMLElement's prototype property to the native\n // HTMLElement's prototype we make sure that:\n // document.createElement('a') instanceof HTMLElement\n // works because instanceof uses HTMLElement.prototype, which is on the\n // ptototype chain of built-in elements.\n win.HTMLElement.prototype = origHTMLElement.prototype;\n\n // patch doc.createElement\n // TODO(justinfagnani): why is the cast neccessary?\n // Can we fix the Closure DOM externs?\n const _origCreateElement =\n /** @type {function(this:Document, string, (Object|undefined)=): !HTMLElement}}*/\n (doc.createElement);\n\n /**\n * Creates a new element and upgrades it if it's a custom element.\n * @param {!Document} doc\n * @param {!string} tagName\n * @param {Object|undefined} options\n * @param {boolean} callConstructor whether or not to call the elements\n * constructor after upgrading. If an element is created by calling its\n * constructor, then `callConstructor` should be false to prevent double\n * initialization.\n */\n function _createElement(doc, tagName, options, callConstructor) {\n const customElements = _customElements();\n const element = options ? _origCreateElement.call(doc, tagName, options) :\n _origCreateElement.call(doc, tagName);\n const definition = customElements._definitions.get(tagName.toLowerCase());\n if (definition) {\n customElements._upgradeElement(element, definition, callConstructor);\n }\n customElements._observeRoot(element);\n return element;\n };\n doc.createElement = function(tagName, options) {\n return _createElement(doc, tagName, options, true);\n }\n\n // patch doc.createElementNS\n\n const HTMLNS = 'http://www.w3.org/1999/xhtml';\n\n /** @type {function(this:Document,string,string):Element} */\n const _origCreateElementNS = doc.createElementNS;\n doc.createElementNS =\n /** @type {function(this:Document,(string|null),string):!Element} */\n (function(namespaceURI, qualifiedName) {\n if (namespaceURI === 'http://www.w3.org/1999/xhtml') {\n return doc.createElement(qualifiedName);\n } else {\n return _origCreateElementNS.call(doc, namespaceURI, qualifiedName);\n }\n });\n\n // patch Element.attachShadow\n\n /** @type {function({closed: boolean})} */\n const _origAttachShadow = Element.prototype['attachShadow'];\n if (_origAttachShadow) {\n Object.defineProperty(Element.prototype, 'attachShadow', {\n value: function(options) {\n /** @type {!Node} */\n const root = _origAttachShadow.call(this, options);\n /** @type {CustomElementRegistry} */\n const customElements = _customElements();\n customElements._observeRoot(root);\n return root;\n },\n });\n }\n\n // patch doc.importNode\n\n const rawImportNode = doc.importNode;\n doc.importNode = function(node, deep) {\n const clone = /** @type{!Node} */(rawImportNode.call(doc, node, deep));\n const customElements = _customElements();\n const nodes = isElement(clone) ? [clone] : clone.childNodes;\n /** @type {CustomElementRegistry} */(_customElements())._addNodes(nodes);\n return clone;\n };\n\n // patch Element.setAttribute & removeAttribute\n\n const _origSetAttribute = Element.prototype.setAttribute;\n Element.prototype['setAttribute'] = function(name, value) {\n changeAttribute(this, name, value, _origSetAttribute);\n };\n const _origRemoveAttribute = Element.prototype.removeAttribute;\n Element.prototype['removeAttribute'] = function(name) {\n changeAttribute(this, name, null, _origRemoveAttribute);\n };\n\n function changeAttribute(element, name, value, operation) {\n name = name.toLowerCase();\n const oldValue = element.getAttribute(name);\n operation.call(element, name, value);\n\n // Bail if this wasn't a fully upgraded custom element\n if (element[_upgradedProp] == true) {\n const definition = _customElements()._definitions.get(element.localName);\n const observedAttributes = definition.observedAttributes;\n const attributeChangedCallback = definition.attributeChangedCallback;\n if (attributeChangedCallback && observedAttributes.indexOf(name) >= 0) {\n const newValue = element.getAttribute(name);\n if (newValue !== oldValue) {\n attributeChangedCallback.call(element, name, oldValue, newValue, null);\n }\n }\n }\n }\n\n Object.defineProperty(window, 'customElements', {\n value: new CustomElementRegistry(),\n configurable: true,\n enumerable: true,\n });\n\n // TODO(justinfagnani): Remove. Temporary for backward-compatibility\n window['CustomElements'] = {\n takeRecords() {\n if (_customElements().flush) _customElements().flush();\n }\n }\n})();\n"],"sourceRoot":"/source/"}