Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Side by Side Diff: packages/web_components/lib/CustomElements.min.js

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * @license 2 * @license
3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. 3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at http://polyme r.github.io/LICENSE.txt 4 * This code may only be used under the BSD style license found at http://polyme r.github.io/LICENSE.txt
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS. txt 5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS. txt
6 * The complete set of contributors may be found at http://polymer.github.io/CON TRIBUTORS.txt 6 * The complete set of contributors may be found at http://polymer.github.io/CON TRIBUTORS.txt
7 * Code distributed by Google as part of the polymer project is also 7 * Code distributed by Google as part of the polymer project is also
8 * subject to an additional IP rights grant found at http://polymer.github.io/PA TENTS.txt 8 * subject to an additional IP rights grant found at http://polymer.github.io/PA TENTS.txt
9 */ 9 */
10 // @version 0.7.21 10 // @version 0.7.23
11 "undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now( )%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.proto type={set:function(t,n){var o=t[this.name];return o&&o[0]===t?o[1]=n:e(t,this.na me,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name]) &&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]== =e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]=== e:!1}},window.WeakMap=n}(),function(e){function t(e){E.push(e),b||(b=!0,w(o))}fu nction n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeed ed(e)||e}function o(){b=!1;var e=E;E=[],e.sort(function(e,t){return e.uid_-t.uid _});var t=!1;e.forEach(function(e){var n=e.takeRecords();r(e),n.length&&(e.callb ack_(n,e),t=!0)}),t&&o()}function r(e){e.nodes_.forEach(function(t){var n=v.get( t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}fun ction i(e,t){for(var n=e;n;n=n.parentNode){var o=v.get(n);if(o)for(var r=0;r<o.l ength;r++){var i=o[r],a=i.options;if(n===e||a.subtree){var d=t(a);d&&i.enqueue(d )}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++ _}function d(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes =[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this .attributeNamespace=null,this.oldValue=null}function s(e){var t=new d(e.type,e.t arget);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.sl ice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attribut eName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.old Value,t}function u(e,t){return y=new d(e,t)}function c(e){return N?N:(N=s(y),N.o ldValue=e,N)}function l(){y=N=void 0}function f(e){return e===N||e===y}function m(e,t){return e===t?e:N&&f(e)?N:null}function p(e,t,n){this.observer=e,this.targ et=t,this.options=n,this.transientObservedNodes=[]}if(!e.JsMutationObserver){var w,v=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))w=setTimeout;else i f(window.setImmediate)w=window.setImmediate;else{var h=[],g=String(Math.random() );window.addEventListener("message",function(e){if(e.data===g){var t=h;h=[],t.fo rEach(function(e){e()})}}),w=function(e){h.push(e),window.postMessage(g,"*")}}va r b=!1,E=[],_=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.at tributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilte r&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characte rData)throw new SyntaxError;var o=v.get(e);o||v.set(e,o=[]);for(var r,i=0;i<o.le ngth;i++)if(o[i].observer===this){r=o[i],r.removeListeners(),r.options=t;break}r ||(r=new p(this,e,t),o.push(r),this.nodes_.push(e)),r.addListeners()},disconnect :function(){this.nodes_.forEach(function(e){for(var t=v.get(e),n=0;n<t.length;n+ +){var o=t[n];if(o.observer===this){o.removeListeners(),t.splice(n,1);break}}},t his),this.records_=[]},takeRecords:function(){var e=this.records_;return this.re cords_=[],e}};var y,N;p.prototype={enqueue:function(e){var n=this.observer.recor ds_,o=n.length;if(n.length>0){var r=n[o-1],i=m(r,e);if(i)return void(n[o-1]=i)}e lse t(this.observer);n[o]=e},addListeners:function(){this.addListeners_(this.tar get)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListe ner("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacter DataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0 ),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},remove Listeners:function(){this.removeListeners_(this.target)},removeListeners_:functi on(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",t his,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,! 0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t .subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver :function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNod es.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObserve rs:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e .forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;n<t.length; n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch( e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e. relatedNode.namespaceURI,o=e.target,r=new u("attributes",o);r.attributeName=t,r. attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValu e;i(o,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.leng th&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0: e.attributeOldValue?c(a):r});break;case"DOMCharacterDataModified":var o=e.target ,r=u("characterData",o),a=e.prevValue;i(o,function(e){return e.characterData?e.c haracterDataOldValue?c(a):r:void 0});break;case"DOMNodeRemoved":this.addTransien tObserver(e.target);case"DOMNodeInserted":var d,s,f=e.target;"DOMNodeInserted"== =e.type?(d=[f],s=[]):(d=[],s=[f]);var m=f.previousSibling,p=f.nextSibling,r=u("c hildList",e.target.parentNode);r.addedNodes=d,r.removedNodes=s,r.previousSibling =m,r.nextSibling=p,i(e.relatedNode,function(e){return e.childList?r:void 0})}l() }},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a,a._isPolyfil led=!0)}}(self),function(e){"use strict";if(!window.performance){var t=Date.now( );window.performance={now:function(){return Date.now()-t}}}window.requestAnimati onFrame||(window.requestAnimationFrame=function(){var e=window.webkitRequestAnim ationFrame||window.mozRequestAnimationFrame;return e?function(t){return e(functi on(){t(performance.now())})}:function(e){return window.setTimeout(e,1e3/60)}}()) ,window.cancelAnimationFrame||(window.cancelAnimationFrame=function(){return win dow.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clea rTimeout(e)}}());var n=function(){var e=document.createEvent("Event");return e.i nitEvent("foo",!0,!0),e.preventDefault(),e.defaultPrevented}();if(!n){var o=Even t.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancel able&&(o.call(this),Object.defineProperty(this,"defaultPrevented",{get:function( ){return!0},configurable:!0}))}}var r=/Trident/.test(navigator.userAgent);if((!w indow.CustomEvent||r&&"function"!=typeof window.CustomEvent)&&(window.CustomEven t=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initC ustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.Custom Event.prototype=window.Event.prototype),!window.Event||r&&"function"!=typeof win dow.Event){var i=window.Event;window.Event=function(e,t){t=t||{};var n=document. createEvent("Event");return n.initEvent(e,Boolean(t.bubbles),Boolean(t.cancelabl e)),n},window.Event.prototype=i.prototype}}(window.WebComponents),window.CustomE lements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[],o=funct ion(e){n.push(e)},r=function(){n.forEach(function(t){t(e)})};e.addModule=o,e.ini tializeModules=r,e.hasNative=Boolean(document.registerElement),e.isIE=/Trident/. test(navigator.userAgent),e.useNative=!t.register&&e.hasNative&&!window.ShadowDO MPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)}(window.CustomEle ments),window.CustomElements.addModule(function(e){function t(e,t){n(e,function( e){return t(e)?!0:void o(e,t)}),o(e,t)}function n(e,t,o){var r=e.firstElementChi ld;if(!r)for(r=e.firstChild;r&&r.nodeType!==Node.ELEMENT_NODE;)r=r.nextSibling;f or(;r;)t(r,o)!==!0&&n(r,t,o),r=r.nextElementSibling;return null}function o(e,n){ for(var o=e.shadowRoot;o;)t(o,n),o=o.olderShadowRoot}function r(e,t){i(e,t,[])}f unction i(e,t,n){if(e=window.wrap(e),!(n.indexOf(e)>=0)){n.push(e);for(var o,r=e .querySelectorAll("link[rel="+a+"]"),d=0,s=r.length;s>d&&(o=r[d]);d++)o["import" ]&&i(o["import"],t,n);t(e)}}var a=window.HTMLImports?window.HTMLImports.IMPORT_L INK_TYPE:"none";e.forDocumentTree=r,e.forSubtree=t}),window.CustomElements.addMo dule(function(e){function t(e,t){return n(e,t)||o(e,t)}function n(t,n){return e. upgrade(t,n)?!0:void(n&&a(t))}function o(e,t){b(e,function(e){return n(e,t)?!0:v oid 0})}function r(e){N.push(e),y||(y=!0,setTimeout(i))}function i(){y=!1;for(va r e,t=N,n=0,o=t.length;o>n&&(e=t[n]);n++)e();N=[]}function a(e){_?r(function(){d (e)}):d(e)}function d(e){e.__upgraded__&&!e.__attached&&(e.__attached=!0,e.attac hedCallback&&e.attachedCallback())}function s(e){u(e),b(e,function(e){u(e)})}fun ction u(e){_?r(function(){c(e)}):c(e)}function c(e){e.__upgraded__&&e.__attached &&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function l(e){for(v ar t=e,n=window.wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.nodeType== =Node.DOCUMENT_FRAGMENT_NODE&&t.host}}function f(e){if(e.shadowRoot&&!e.shadowRo ot.__watched){g.dom&&console.log("watching shadow-root for: ",e.localName);for(v ar t=e.shadowRoot;t;)w(t),t=t.olderShadowRoot}}function m(e,n){if(g.dom){var o=n [0];if(o&&"childList"===o.type&&o.addedNodes&&o.addedNodes){for(var r=o.addedNod es[0];r&&r!==document&&!r.host;)r=r.parentNode;var i=r&&(r.URL||r._URL||r.host&& r.host.localName)||"";i=i.split("/?").shift().split("/").pop()}console.group("mu tations (%d) [%s]",n.length,i||"")}var a=l(e);n.forEach(function(e){"childList"= ==e.type&&(M(e.addedNodes,function(e){e.localName&&t(e,a)}),M(e.removedNodes,fun ction(e){e.localName&&s(e)}))}),g.dom&&console.groupEnd()}function p(e){for(e=wi ndow.wrap(e),e||(e=window.wrap(document));e.parentNode;)e=e.parentNode;var t=e._ _observer;t&&(m(e,t.takeRecords()),i())}function w(e){if(!e.__observer){var t=ne w MutationObserver(m.bind(this,e));t.observe(e,{childList:!0,subtree:!0}),e.__ob server=t}}function v(e){e=window.wrap(e),g.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop());var n=e===window.wrap(document);t(e,n),w(e),g.dom& &console.groupEnd()}function h(e){E(e,v)}var g=e.flags,b=e.forSubtree,E=e.forDoc umentTree,_=window.MutationObserver._isPolyfilled&&g["throttle-attached"];e.hasP olyfillMutations=_,e.hasThrottledAttached=_;var y=!1,N=[],M=Array.prototype.forE ach.call.bind(Array.prototype.forEach),O=Element.prototype.createShadowRoot;O&&( Element.prototype.createShadowRoot=function(){var e=O.call(this);return window.C ustomElements.watchShadow(this),e}),e.watchShadow=f,e.upgradeDocumentTree=h,e.up gradeDocument=v,e.upgradeSubtree=o,e.upgradeAll=t,e.attached=a,e.takeRecords=p}) ,window.CustomElements.addModule(function(e){function t(t,o){if("template"===t.l ocalName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplate Element.decorate(t),!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var r=t.get Attribute("is"),i=e.getRegisteredDefinition(t.localName)||e.getRegisteredDefinit ion(r);if(i&&(r&&i.tag==t.localName||!r&&!i["extends"]))return n(t,i,o)}}functio n n(t,n,r){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAt tribute("is",n.is),o(t,n),t.__upgraded__=!0,i(t),r&&e.attached(t),e.upgradeSubtr ee(t,r),a.upgrade&&console.groupEnd(),t}function o(e,t){Object.__proto__?e.__pro to__=t.prototype:(r(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function r(e,t,n){for(var o={},r=t;r!==n&&r!==HTMLElement.prototype;){for(var i,a=Object .getOwnPropertyNames(r),d=0;i=a[d];d++)o[i]||(Object.defineProperty(e,i,Object.g etOwnPropertyDescriptor(r,i)),o[i]=1);r=Object.getPrototypeOf(r)}}function i(e){ e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDe finition=n,e.implementPrototype=o}),window.CustomElements.addModule(function(e){ function t(t,o){var s=o||{};if(!t)throw new Error("document.registerElement: fir st argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("docu ment.registerElement: first argument ('name') must contain a dash ('-'). Argumen t provided was '"+String(t)+"'.");if(r(t))throw new Error("Failed to execute 're gisterElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(u(t))throw new Error("DuplicateDefinitionError: a typ e with name '"+String(t)+"' is already registered");return s.prototype||(s.proto type=Object.create(HTMLElement.prototype)),s.__name=t.toLowerCase(),s.lifecycle= s.lifecycle||{},s.ancestry=i(s["extends"]),a(s),d(s),n(s.prototype),c(s.__name,s ),s.ctor=l(s),s.ctor.prototype=s.prototype,s.prototype.constructor=s.ctor,e.read y&&h(document),s.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setA ttribute;e.setAttribute=function(e,n){o.call(this,e,n,t)};var n=e.removeAttribut e;e.removeAttribute=function(e){o.call(this,e,null,n)},e.setAttribute._polyfille d=!0}}function o(e,t,n){e=e.toLowerCase();var o=this.getAttribute(e);n.apply(thi s,arguments);var r=this.getAttribute(e);this.attributeChangedCallback&&r!==o&&th is.attributeChangedCallback(e,o,r)}function r(e){for(var t=0;t<y.length;t++)if(e ===y[t])return!0}function i(e){var t=u(e);return t?i(t["extends"]).concat([t]):[ ]}function a(e){for(var t,n=e["extends"],o=0;t=e.ancestry[o];o++)n=t.is&&t.tag;e .tag=n||e.__name,n&&(e.is=e.__name)}function d(e){if(!Object.__proto__){var t=HT MLElement.prototype;if(e.is){var n=document.createElement(e.tag);t=Object.getPro totypeOf(n)}for(var o,r=e.prototype,i=!1;r;)r==t&&(i=!0),o=Object.getPrototypeOf (r),o&&(r.__proto__=o),r=o;i||console.warn(e.tag+" prototype not found in protot ype chain for "+e.is),e["native"]=t}}function s(e){return b(O(e.tag),e)}function u(e){return e?N[e.toLowerCase()]:void 0}function c(e,t){N[e]=t}function l(e){re turn function(){return s(e)}}function f(e,t,n){return e===M?m(t,n):D(e,t)}functi on m(e,t){e&&(e=e.toLowerCase()),t&&(t=t.toLowerCase());var n=u(t||e);if(n){if(e ==n.tag&&t==n.is)return new n.ctor;if(!t&&!n.is)return new n.ctor}var o;return t ?(o=m(e),o.setAttribute("is",t),o):(o=O(e),e.indexOf("-")>=0&&E(o,HTMLElement),o )}function p(e,t){var n=e[t];e[t]=function(){var e=n.apply(this,arguments);retur n g(e),e}}var w,v=e.isIE,h=e.upgradeDocumentTree,g=e.upgradeAll,b=e.upgradeWithD efinition,E=e.implementPrototype,_=e.useNative,y=["annotation-xml","color-profil e","font-face","font-face-src","font-face-uri","font-face-format","font-face-nam e","missing-glyph"],N={},M="http://www.w3.org/1999/xhtml",O=document.createEleme nt.bind(document),D=document.createElementNS.bind(document);w=Object.__proto__|| _?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0; for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},p(Node.proto type,"cloneNode"),p(document,"importNode"),v&&!function(){var e=document.importN ode;document.importNode=function(){var t=e.apply(document,arguments);if(t.nodeTy pe==t.DOCUMENT_FRAGMENT_NODE){var n=document.createDocumentFragment();return n.a ppendChild(t),n}return t}}(),document.registerElement=t,document.createElement=m ,document.createElementNS=f,e.registry=N,e["instanceof"]=w,e.reservedTagList=y,e .getRegisteredDefinition=u,document.register=document.registerElement}),function (e){function t(){i(window.wrap(document)),window.CustomElements.ready=!0;var e=w indow.requestAnimationFrame||function(e){setTimeout(e,16)};e(function(){setTimeo ut(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(wi ndow.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.r eadyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:! 0}))})})}var n=e.useNative,o=e.initializeModules;e.isIE;if(n){var r=function(){} ;e.watchShadow=r,e.upgrade=r,e.upgradeAll=r,e.upgradeDocumentTree=r,e.upgradeSub tree=r,e.takeRecords=r,e["instanceof"]=function(e,t){return e instanceof t}}else o();var i=e.upgradeDocumentTree,a=e.upgradeDocument;if(window.wrap||(window.Sha dowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap= window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){r eturn e}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function( e){e["import"]&&a(wrap(e["import"]))}),"complete"===document.readyState||e.flags .eager)t();else if("interactive"!==document.readyState||window.attachEvent||wind ow.HTMLImports&&!window.HTMLImports.ready){var d=window.HTMLImports&&!window.HTM LImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(d, t)}else t()}(window.CustomElements); 11 "undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now( )%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.proto type={set:function(t,n){var o=t[this.name];return o&&o[0]===t?o[1]=n:e(t,this.na me,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name]) &&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return!(!t||t[0] !==e)&&(t[0]=t[1]=void 0,!0)},has:function(e){var t=e[this.name];return!!t&&t[0] ===e}},window.WeakMap=n}(),function(e){function t(e){E.push(e),b||(b=!0,m(o))}fu nction n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeed ed(e)||e}function o(){b=!1;var e=E;E=[],e.sort(function(e,t){return e.uid_-t.uid _});var t=!1;e.forEach(function(e){var n=e.takeRecords();r(e),n.length&&(e.callb ack_(n,e),t=!0)}),t&&o()}function r(e){e.nodes_.forEach(function(t){var n=v.get( t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}fun ction i(e,t){for(var n=e;n;n=n.parentNode){var o=v.get(n);if(o)for(var r=0;r<o.l ength;r++){var i=o[r],a=i.options;if(n===e||a.subtree){var d=t(a);d&&i.enqueue(d )}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++ _}function d(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes =[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this .attributeNamespace=null,this.oldValue=null}function s(e){var t=new d(e.type,e.t arget);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.sl ice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attribut eName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.old Value,t}function u(e,t){return y=new d(e,t)}function c(e){return N?N:(N=s(y),N.o ldValue=e,N)}function l(){y=N=void 0}function f(e){return e===N||e===y}function p(e,t){return e===t?e:N&&f(e)?N:null}function w(e,t,n){this.observer=e,this.targ et=t,this.options=n,this.transientObservedNodes=[]}if(!e.JsMutationObserver){var m,v=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))m=setTimeout;else i f(window.setImmediate)m=window.setImmediate;else{var h=[],g=String(Math.random() );window.addEventListener("message",function(e){if(e.data===g){var t=h;h=[],t.fo rEach(function(e){e()})}}),m=function(e){h.push(e),window.postMessage(g,"*")}}va r b=!1,E=[],_=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.at tributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilte r&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characte rData)throw new SyntaxError;var o=v.get(e);o||v.set(e,o=[]);for(var r,i=0;i<o.le ngth;i++)if(o[i].observer===this){r=o[i],r.removeListeners(),r.options=t;break}r ||(r=new w(this,e,t),o.push(r),this.nodes_.push(e)),r.addListeners()},disconnect :function(){this.nodes_.forEach(function(e){for(var t=v.get(e),n=0;n<t.length;n+ +){var o=t[n];if(o.observer===this){o.removeListeners(),t.splice(n,1);break}}},t his),this.records_=[]},takeRecords:function(){var e=this.records_;return this.re cords_=[],e}};var y,N;w.prototype={enqueue:function(e){var n=this.observer.recor ds_,o=n.length;if(n.length>0){var r=n[o-1],i=p(r,e);if(i)return void(n[o-1]=i)}e lse t(this.observer);n[o]=e},addListeners:function(){this.addListeners_(this.tar get)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListe ner("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacter DataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0 ),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},remove Listeners:function(){this.removeListeners_(this.target)},removeListeners_:functi on(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",t his,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,! 0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t .subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver :function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNod es.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObserve rs:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e .forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;n<t.length; n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch( e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e. relatedNode.namespaceURI,o=e.target,r=new u("attributes",o);r.attributeName=t,r. attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValu e;i(o,function(e){if(e.attributes&&(!e.attributeFilter||!e.attributeFilter.lengt h||e.attributeFilter.indexOf(t)!==-1||e.attributeFilter.indexOf(n)!==-1))return e.attributeOldValue?c(a):r});break;case"DOMCharacterDataModified":var o=e.target ,r=u("characterData",o),a=e.prevValue;i(o,function(e){if(e.characterData)return e.characterDataOldValue?c(a):r});break;case"DOMNodeRemoved":this.addTransientObs erver(e.target);case"DOMNodeInserted":var d,s,f=e.target;"DOMNodeInserted"===e.t ype?(d=[f],s=[]):(d=[],s=[f]);var p=f.previousSibling,w=f.nextSibling,r=u("child List",e.target.parentNode);r.addedNodes=d,r.removedNodes=s,r.previousSibling=p,r .nextSibling=w,i(e.relatedNode,function(e){if(e.childList)return r})}l()}},e.JsM utationObserver=a,e.MutationObserver||(e.MutationObserver=a,a._isPolyfilled=!0)} }(self),function(e){"use strict";if(!window.performance||!window.performance.now ){var t=Date.now();window.performance={now:function(){return Date.now()-t}}}wind ow.requestAnimationFrame||(window.requestAnimationFrame=function(){var e=window. webkitRequestAnimationFrame||window.mozRequestAnimationFrame;return e?function(t ){return e(function(){t(performance.now())})}:function(e){return window.setTimeo ut(e,1e3/60)}}()),window.cancelAnimationFrame||(window.cancelAnimationFrame=func tion(){return window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame| |function(e){clearTimeout(e)}}());var n=function(){var e=document.createEvent("E vent");return e.initEvent("foo",!0,!0),e.preventDefault(),e.defaultPrevented}(); if(!n){var o=Event.prototype.preventDefault;Event.prototype.preventDefault=funct ion(){this.cancelable&&(o.call(this),Object.defineProperty(this,"defaultPrevente d",{get:function(){return!0},configurable:!0}))}}var r=/Trident/.test(navigator. userAgent);if((!window.CustomEvent||r&&"function"!=typeof window.CustomEvent)&&( window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent ");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail) ,n},window.CustomEvent.prototype=window.Event.prototype),!window.Event||r&&"func tion"!=typeof window.Event){var i=window.Event;window.Event=function(e,t){t=t||{ };var n=document.createEvent("Event");return n.initEvent(e,Boolean(t.bubbles),Bo olean(t.cancelable)),n},window.Event.prototype=i.prototype}}(window.WebComponent s),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.f lags,n=[],o=function(e){n.push(e)},r=function(){n.forEach(function(t){t(e)})};e. addModule=o,e.initializeModules=r,e.hasNative=Boolean(document.registerElement), e.isIE=/Trident/.test(navigator.userAgent),e.useNative=!t.register&&e.hasNative& &!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)} (window.CustomElements),window.CustomElements.addModule(function(e){function t(e ,t){n(e,function(e){return!!t(e)||void o(e,t)}),o(e,t)}function n(e,t,o){var r=e .firstElementChild;if(!r)for(r=e.firstChild;r&&r.nodeType!==Node.ELEMENT_NODE;)r =r.nextSibling;for(;r;)t(r,o)!==!0&&n(r,t,o),r=r.nextElementSibling;return null} function o(e,n){for(var o=e.shadowRoot;o;)t(o,n),o=o.olderShadowRoot}function r( e,t){i(e,t,[])}function i(e,t,n){if(e=window.wrap(e),!(n.indexOf(e)>=0)){n.push( e);for(var o,r=e.querySelectorAll("link[rel="+a+"]"),d=0,s=r.length;d<s&&(o=r[d] );d++)o["import"]&&i(o["import"],t,n);t(e)}}var a=window.HTMLImports?window.HTML Imports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=r,e.forSubtree=t}),window.Cust omElements.addModule(function(e){function t(e,t){return n(e,t)||o(e,t)}function n(t,n){return!!e.upgrade(t,n)||void(n&&a(t))}function o(e,t){b(e,function(e){if( n(e,t))return!0})}function r(e){N.push(e),y||(y=!0,setTimeout(i))}function i(){y =!1;for(var e,t=N,n=0,o=t.length;n<o&&(e=t[n]);n++)e();N=[]}function a(e){_?r(fu nction(){d(e)}):d(e)}function d(e){e.__upgraded__&&!e.__attached&&(e.__attached= !0,e.attachedCallback&&e.attachedCallback())}function s(e){u(e),b(e,function(e){ u(e)})}function u(e){_?r(function(){c(e)}):c(e)}function c(e){e.__upgraded__&&e. __attached&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function l(e){for(var t=e,n=window.wrap(document);t;){if(t==n)return!0;t=t.parentNode||t. nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host}}function f(e){if(e.shadowRoot&&! e.shadowRoot.__watched){g.dom&&console.log("watching shadow-root for: ",e.localN ame);for(var t=e.shadowRoot;t;)m(t),t=t.olderShadowRoot}}function p(e,n){if(g.do m){var o=n[0];if(o&&"childList"===o.type&&o.addedNodes&&o.addedNodes){for(var r= o.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var i=r&&(r.URL||r._URL ||r.host&&r.host.localName)||"";i=i.split("/?").shift().split("/").pop()}console .group("mutations (%d) [%s]",n.length,i||"")}var a=l(e);n.forEach(function(e){"c hildList"===e.type&&(M(e.addedNodes,function(e){e.localName&&t(e,a)}),M(e.remove dNodes,function(e){e.localName&&s(e)}))}),g.dom&&console.groupEnd()}function w(e ){for(e=window.wrap(e),e||(e=window.wrap(document));e.parentNode;)e=e.parentNode ;var t=e.__observer;t&&(p(e,t.takeRecords()),i())}function m(e){if(!e.__observer ){var t=new MutationObserver(p.bind(this,e));t.observe(e,{childList:!0,subtree:! 0}),e.__observer=t}}function v(e){e=window.wrap(e),g.dom&&console.group("upgrade Document: ",e.baseURI.split("/").pop());var n=e===window.wrap(document);t(e,n),m (e),g.dom&&console.groupEnd()}function h(e){E(e,v)}var g=e.flags,b=e.forSubtree, E=e.forDocumentTree,_=window.MutationObserver._isPolyfilled&&g["throttle-attache d"];e.hasPolyfillMutations=_,e.hasThrottledAttached=_;var y=!1,N=[],M=Array.prot otype.forEach.call.bind(Array.prototype.forEach),O=Element.prototype.createShado wRoot;O&&(Element.prototype.createShadowRoot=function(){var e=O.call(this);retur n window.CustomElements.watchShadow(this),e}),e.watchShadow=f,e.upgradeDocumentT ree=h,e.upgradeDocument=v,e.upgradeSubtree=o,e.upgradeAll=t,e.attached=a,e.takeR ecords=w}),window.CustomElements.addModule(function(e){function t(t,o){if("templ ate"===t.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HT MLTemplateElement.decorate(t),!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){v ar r=t.getAttribute("is"),i=e.getRegisteredDefinition(t.localName)||e.getRegiste redDefinition(r);if(i&&(r&&i.tag==t.localName||!r&&!i["extends"]))return n(t,i,o )}}function n(t,n,r){return a.upgrade&&console.group("upgrade:",t.localName),n.i s&&t.setAttribute("is",n.is),o(t,n),t.__upgraded__=!0,i(t),r&&e.attached(t),e.up gradeSubtree(t,r),a.upgrade&&console.groupEnd(),t}function o(e,t){Object.__proto __?e.__proto__=t.prototype:(r(e,t.prototype,t["native"]),e.__proto__=t.prototype )}function r(e,t,n){for(var o={},r=t;r!==n&&r!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(r),d=0;i=a[d];d++)o[i]||(Object.defineProperty(e, i,Object.getOwnPropertyDescriptor(r,i)),o[i]=1);r=Object.getPrototypeOf(r)}}func tion i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upg radeWithDefinition=n,e.implementPrototype=o}),window.CustomElements.addModule(fu nction(e){function t(t,o){var s=o||{};if(!t)throw new Error("document.registerEl ement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new E rror("document.registerElement: first argument ('name') must contain a dash ('-' ). Argument provided was '"+String(t)+"'.");if(r(t))throw new Error("Failed to e xecute 'registerElement' on 'Document': Registration failed for type '"+String(t )+"'. The type name is invalid.");if(u(t))throw new Error("DuplicateDefinitionEr ror: a type with name '"+String(t)+"' is already registered");return s.prototype ||(s.prototype=Object.create(HTMLElement.prototype)),s.__name=t.toLowerCase(),s[ "extends"]&&(s["extends"]=s["extends"].toLowerCase()),s.lifecycle=s.lifecycle||{ },s.ancestry=i(s["extends"]),a(s),d(s),n(s.prototype),c(s.__name,s),s.ctor=l(s), s.ctor.prototype=s.prototype,s.prototype.constructor=s.ctor,e.ready&&v(document) ,s.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.set Attribute=function(e,n){o.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttr ibute=function(e){o.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function o(e,t,n){e=e.toLowerCase();var o=this.getAttribute(e);n.apply(this,arguments);v ar r=this.getAttribute(e);this.attributeChangedCallback&&r!==o&&this.attributeCh angedCallback(e,o,r)}function r(e){for(var t=0;t<_.length;t++)if(e===_[t])return !0}function i(e){var t=u(e);return t?i(t["extends"]).concat([t]):[]}function a(e ){for(var t,n=e["extends"],o=0;t=e.ancestry[o];o++)n=t.is&&t.tag;e.tag=n||e.__na me,n&&(e.is=e.__name)}function d(e){if(!Object.__proto__){var t=HTMLElement.prot otype;if(e.is){var n=document.createElement(e.tag);t=Object.getPrototypeOf(n)}fo r(var o,r=e.prototype,i=!1;r;)r==t&&(i=!0),o=Object.getPrototypeOf(r),o&&(r.__pr oto__=o),r=o;i||console.warn(e.tag+" prototype not found in prototype chain for "+e.is),e["native"]=t}}function s(e){return g(M(e.tag),e)}function u(e){if(e)ret urn y[e.toLowerCase()]}function c(e,t){y[e]=t}function l(e){return function(){re turn s(e)}}function f(e,t,n){return e===N?p(t,n):O(e,t)}function p(e,t){e&&(e=e. toLowerCase()),t&&(t=t.toLowerCase());var n=u(t||e);if(n){if(e==n.tag&&t==n.is)r eturn new n.ctor;if(!t&&!n.is)return new n.ctor}var o;return t?(o=p(e),o.setAttr ibute("is",t),o):(o=M(e),e.indexOf("-")>=0&&b(o,HTMLElement),o)}function w(e,t){ var n=e[t];e[t]=function(){var e=n.apply(this,arguments);return h(e),e}}var m,v= (e.isIE,e.upgradeDocumentTree),h=e.upgradeAll,g=e.upgradeWithDefinition,b=e.impl ementPrototype,E=e.useNative,_=["annotation-xml","color-profile","font-face","fo nt-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph" ],y={},N="http://www.w3.org/1999/xhtml",M=document.createElement.bind(document), O=document.createElementNS.bind(document);m=Object.__proto__||E?function(e,t){re turn e instanceof t}:function(e,t){if(e instanceof t)return!0;for(var n=e;n;){if (n===t.prototype)return!0;n=n.__proto__}return!1},w(Node.prototype,"cloneNode"), w(document,"importNode"),document.registerElement=t,document.createElement=p,doc ument.createElementNS=f,e.registry=y,e["instanceof"]=m,e.reservedTagList=_,e.get RegisteredDefinition=u,document.register=document.registerElement}),function(e){ function t(){i(window.wrap(document)),window.CustomElements.ready=!0;var e=windo w.requestAnimationFrame||function(e){setTimeout(e,16)};e(function(){setTimeout(f unction(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window .CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.ready Time),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0})) })})}var n=e.useNative,o=e.initializeModules;e.isIE;if(n){var r=function(){};e.w atchShadow=r,e.upgrade=r,e.upgradeAll=r,e.upgradeDocumentTree=r,e.upgradeSubtree =r,e.takeRecords=r,e["instanceof"]=function(e,t){return e instanceof t}}else o() ;var i=e.upgradeDocumentTree,a=e.upgradeDocument;if(window.wrap||(window.ShadowD OMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=wind ow.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){retur n e}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(e){e ["import"]&&a(wrap(e["import"]))}),"complete"===document.readyState||e.flags.eag er)t();else if("interactive"!==document.readyState||window.attachEvent||window.H TMLImports&&!window.HTMLImports.ready){var d=window.HTMLImports&&!window.HTMLImp orts.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(d,t)}e lse t()}(window.CustomElements);
OLDNEW
« no previous file with comments | « packages/web_components/lib/CustomElements.js ('k') | packages/web_components/lib/HTMLImports.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698