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

Side by Side Diff: pkg/custom_element/lib/custom-elements.min.js

Issue 23498053: Revert "Revert "Dart2js support for custom element lifecycle events"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Polymer Authors. All rights reserved. 1 // Copyright (c) 2012 The Polymer Authors. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer 10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the 11 // in the documentation and/or other materials provided with the
12 // distribution. 12 // distribution.
13 // * Neither the name of Google Inc. nor the names of its 13 // * Neither the name of Google Inc. nor the names of its
14 // contributors may be used to endorse or promote products derived from 14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission. 15 // this software without specific prior written permission.
16 // 16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 window.CustomElements={flags:{}};var SideTable;if("undefined"!=typeof WeakMap&&n avigator.userAgent.indexOf("Firefox/")<0?SideTable=WeakMap:function(){var a=Obje ct.defineProperty,b=Date.now()%1e9;SideTable=function(){this.name="__st"+(1e9*Ma th.random()>>>0)+(b++ +"__")},SideTable.prototype={set:function(b,c){var d=b[thi s.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:functio n(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){th is.set(a,void 0)}}}(),function(a){function b(a){u.push(a),t||(t=!0,q(d))}functio n c(a){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(a) ||a}function d(){t=!1;var a=u;u=[],a.sort(function(a,b){return a.uid_-b.uid_});v ar b=!1;a.forEach(function(a){var c=a.takeRecords();e(a),c.length&&(a.callback_( c,a),b=!0)}),b&&d()}function e(a){a.nodes_.forEach(function(b){var c=p.get(b);c& &c.forEach(function(b){b.observer===a&&b.removeTransientObservers()})})}function f(a,b){for(var c=a;c;c=c.parentNode){var d=p.get(c);if(d)for(var e=0;e<d.length ;e++){var f=d[e],g=f.options;if(c===a||g.subtree){var h=b(g);h&&f.enqueue(h)}}}} function g(a){this.callback_=a,this.nodes_=[],this.records_=[],this.uid_=++v}fun ction h(a,b){this.type=a,this.target=b,this.addedNodes=[],this.removedNodes=[],t his.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attr ibuteNamespace=null,this.oldValue=null}function i(a){var b=new h(a.type,a.target );return b.addedNodes=a.addedNodes.slice(),b.removedNodes=a.removedNodes.slice() ,b.previousSibling=a.previousSibling,b.nextSibling=a.nextSibling,b.attributeName =a.attributeName,b.attributeNamespace=a.attributeNamespace,b.oldValue=a.oldValue ,b}function j(a,b){return w=new h(a,b)}function k(a){return x?x:(x=i(w),x.oldVal ue=a,x)}function l(){w=x=void 0}function m(a){return a===x||a===w}function n(a,b ){return a===b?a:x&&m(a)?x:null}function o(a,b,c){this.observer=a,this.target=b, this.options=c,this.transientObservedNodes=[]}var p=new SideTable,q=window.msSet Immediate;if(!q){var r=[],s=String(Math.random());window.addEventListener("messa ge",function(a){if(a.data===s){var b=r;r=[],b.forEach(function(a){a()})}}),q=fun ction(a){r.push(a),window.postMessage(s,"*")}}var t=!1,u=[],v=0;g.prototype={obs erve:function(a,b){if(a=c(a),!b.childList&&!b.attributes&&!b.characterData||b.at tributeOldValue&&!b.attributes||b.attributeFilter&&b.attributeFilter.length&&!b. attributes||b.characterDataOldValue&&!b.characterData)throw new SyntaxError;var d=p.get(a);d||p.set(a,d=[]);for(var e,f=0;f<d.length;f++)if(d[f].observer===this ){e=d[f],e.removeListeners(),e.options=b;break}e||(e=new o(this,a,b),d.push(e),t his.nodes_.push(a)),e.addListeners()},disconnect:function(){this.nodes_.forEach( function(a){for(var b=p.get(a),c=0;c<b.length;c++){var d=b[c];if(d.observer===th is){d.removeListeners(),b.splice(c,1);break}}},this),this.records_=[]},takeRecor ds:function(){var a=this.records_;return this.records_=[],a}};var w,x;o.prototyp e={enqueue:function(a){var c=this.observer.records_,d=c.length;if(c.length>0){va r e=c[d-1],f=n(e,a);if(f)return c[d-1]=f,void 0}else b(this.observer);c[d]=a},ad dListeners:function(){this.addListeners_(this.target)},addListeners_:function(a) {var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0), b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childL ist&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.a ddEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.remov eListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attr ibutes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.remo veEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventLi stener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListene r("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target ){this.addListeners_(a),this.transientObservedNodes.push(a);var b=p.get(a);b||p. set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transi entObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.remov eListeners_(a);for(var b=p.get(a),c=0;c<b.length;c++)if(b[c]===this){b.splice(c, 1);break}},this)},handleEvent:function(a){switch(a.stopImmediatePropagation(),a. type){case"DOMAttrModified":var b=a.attrName,c=a.relatedNode.namespaceURI,d=a.ta rget,e=new j("attributes",d);e.attributeName=b,e.attributeNamespace=c;var g=a.at trChange===MutationEvent.ADDITION?null:a.prevValue;f(d,function(a){return!a.attr ibutes||a.attributeFilter&&a.attributeFilter.length&&-1===a.attributeFilter.inde xOf(b)&&-1===a.attributeFilter.indexOf(c)?void 0:a.attributeOldValue?k(g):e});br eak;case"DOMCharacterDataModified":var d=a.target,e=j("characterData",d),g=a.pre vValue;f(d,function(a){return a.characterData?a.characterDataOldValue?k(g):e:voi d 0});break;case"DOMNodeRemoved":this.addTransientObserver(a.target);case"DOMNod eInserted":var h,i,d=a.relatedNode,m=a.target;"DOMNodeInserted"===a.type?(h=[m], i=[]):(h=[],i=[m]);var n=m.previousSibling,o=m.nextSibling,e=j("childList",d);e. addedNodes=h,e.removedNodes=i,e.previousSibling=n,e.nextSibling=o,f(d,function(a ){return a.childList?e:void 0})}l()}},a.JsMutationObserver=g}(this),!window.Muta tionObserver&&(window.MutationObserver=window.WebKitMutationObserver||window.JsM utationObserver,!MutationObserver))throw new Error("no mutation observer support ");!function(a){function b(a,c,d){var e=a.firstElementChild;if(!e)for(e=a.firstC hild;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;for(;e;)c(e,d)!==!0&&b(e ,c,d),e=e.nextElementSibling;return null}function c(a,b){for(var c=a.webkitShado wRoot;c;)d(c,b),c=c.olderShadowRoot}function d(a,d){b(a,function(a){return d(a)? !0:(c(a,d),void 0)}),c(a,d)}function e(a){return h(a)?(i(a),!0):(j(a),void 0)}fu nction f(a){d(a,function(a){return e(a)?!0:void 0})}function g(a){return e(a)||f (a)}function h(b){if(!b.__upgraded__&&b.nodeType===Node.ELEMENT_NODE){var c=b.ge tAttribute("is")||b.localName,d=a.registry[c];if(d)return v.dom&&console.group(" upgrade:",b.localName),a.upgrade(b),v.dom&&console.groupEnd(),!0}}function i(a){ j(a),m(a)&&d(a,function(a){j(a)})}function j(a){(a.enteredViewCallback||a.__upgr aded__&&v.dom)&&(v.dom&&console.group("inserted:",a.localName),m(a)&&(a.__insert ed=(a.__inserted||0)+1,a.__inserted<1&&(a.__inserted=1),a.__inserted>1?v.dom&&co nsole.warn("inserted:",a.localName,"insert/remove count:",a.__inserted):a.entere dViewCallback&&(v.dom&&console.log("inserted:",a.localName),a.enteredViewCallbac k())),v.dom&&console.groupEnd())}function k(a){l(a),d(a,function(a){l(a)})}funct ion l(a){(a.leftViewCallback||a.__upgraded__&&v.dom)&&(v.dom&&console.log("remov ed:",a.localName),m(a)||(a.__inserted=(a.__inserted||0)-1,a.__inserted>0&&(a.__i nserted=0),a.__inserted<0?v.dom&&console.warn("removed:",a.localName,"insert/rem ove count:",a.__inserted):a.leftViewCallback&&a.leftViewCallback()))}function m( a){for(var b=a,c=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded (document)||document;b;){if(b==c)return!0;b=b.parentNode||b.host}}function n(a){ if(a.webkitShadowRoot&&!a.webkitShadowRoot.__watched){v.dom&&console.log("watchi ng shadow-root for: ",a.localName);for(var b=a.webkitShadowRoot;b;)o(b),b=b.olde rShadowRoot}}function o(a){a.__watched||(s(a),a.__watched=!0)}function p(a){swit ch(a.localName){case"style":case"script":case"template":case void 0:return!0}}fu nction q(a){if(v.dom){var b=a[0];if(b&&"childList"===b.type&&b.addedNodes&&b.add edNodes){for(var c=b.addedNodes[0];c&&c!==document&&!c.host;)c=c.parentNode;var d=c&&(c.URL||c._URL||c.host&&c.host.localName)||"";d=d.split("/?").shift().split ("/").pop()}console.group("mutations (%d) [%s]",a.length,d||"")}a.forEach(functi on(a){"childList"===a.type&&(x(a.addedNodes,function(a){p(a)||g(a)}),x(a.removed Nodes,function(a){p(a)||k(a)}))}),v.dom&&console.groupEnd()}function r(){q(w.tak eRecords())}function s(a){w.observe(a,{childList:!0,subtree:!0})}function t(a){s (a)}function u(a){v.dom&&console.group("upgradeDocument: ",(a.URL||a._URL||"").s plit("/").pop()),g(a),v.dom&&console.groupEnd()}var v=window.logFlags||{},w=new MutationObserver(q),x=Array.prototype.forEach.call.bind(Array.prototype.forEach) ;a.watchShadow=n,a.upgradeAll=g,a.upgradeSubtree=f,a.observeDocument=t,a.upgrade Document=u,a.takeRecords=r}(window.CustomElements),function(a){function b(b,f){v ar g=f||{};if(!b)throw new Error("document.register: first argument `name` must not be empty");if(b.indexOf("-")<0)throw new Error("document.register: first arg ument ('name') must contain a dash ('-'). Argument provided was '"+String(b)+"'. ");if(g.name=b,!g.prototype)throw new Error("Options missing required prototype property");return g.lifecycle=g.lifecycle||{},g.ancestry=c(g.extends),d(g),e(g), k(g.prototype),m(b,g),g.ctor=n(g),g.ctor.prototype=g.prototype,g.prototype.const ructor=g.ctor,a.ready&&a.upgradeAll(document),g.ctor}function c(a){var b=v[a];re turn b?c(b.extends).concat([b]):[]}function d(a){for(var b,c=a.extends,d=0;b=a.a ncestry[d];d++)c=b.is&&b.tag;a.tag=c||a.name,c&&(a.is=a.name)}function e(a){if(! Object.__proto__){var b=HTMLElement.prototype;if(a.is){var c=document.createElem ent(a.tag);b=Object.getPrototypeOf(c)}for(var d,e=a.prototype;e&&e!==b;){var d=O bject.getPrototypeOf(e);e.__proto__=d,e=d}}a.native=b}function f(a){return g(w(a .tag),a)}function g(b,c){return c.is&&b.setAttribute("is",c.is),h(b,c),b.__upgra ded__=!0,a.upgradeSubtree(b),j(b),b}function h(a,b){Object.__proto__?a.__proto__ =b.prototype:(i(a,b.prototype,b.native),a.__proto__=b.prototype)}function i(a,b, c){for(var d={},e=b;e!==c&&e!==HTMLUnknownElement.prototype;){for(var f,g=Object .getOwnPropertyNames(e),h=0;f=g[h];h++)d[f]||(Object.defineProperty(a,f,Object.g etOwnPropertyDescriptor(e,f)),d[f]=1);e=Object.getPrototypeOf(e)}}function j(a){ a.createdCallback&&a.createdCallback()}function k(a){var b=a.setAttribute;a.setA ttribute=function(a,c){l.call(this,a,c,b)};var c=a.removeAttribute;a.removeAttri bute=function(a,b){l.call(this,a,b,c)}}function l(a,b,c){var d=this.getAttribute (a);c.apply(this,arguments),this.attributeChangedCallback&&this.getAttribute(a)! ==d&&this.attributeChangedCallback(a,d)}function m(a,b){if(v[a])throw new Error( "Cannot register a tag more than once");v[a]=b}function n(a){return function(){r eturn f(a)}}function o(a,b){var c=v[b||a];if(c){if(a==c.tag&&b==c.is)return new c.ctor;if(!b&&!c.is)return new c.ctor}if(b){var d=o(a);return d.setAttribute("is ",b),d}var d=w(a);return a.indexOf("-")>=0&&h(d,HTMLElement),d}function p(a){if( !a.__upgraded__&&a.nodeType===Node.ELEMENT_NODE){var b=a.getAttribute("is"),c=v[ b||a.localName];if(c){if(b&&c.tag==a.localName)return g(a,c);if(!b&&!c.extends)r eturn g(a,c)}}}function q(b){var c=x.call(this,b);return a.upgradeAll(c),c}a||(a =window.CustomElements={flags:{}});var r=a.flags,s=Boolean(document.register),t= !r.register&&s;if(t){var u=function(){};a.registry={},a.upgradeElement=u,a.watch Shadow=u,a.upgrade=u,a.upgradeAll=u,a.upgradeSubtree=u,a.observeDocument=u,a.upg radeDocument=u,a.takeRecords=u}else{var v={},w=document.createElement.bind(docum ent),x=Node.prototype.cloneNode;document.register=b,document.createElement=o,Nod e.prototype.cloneNode=q,a.registry=v,a.upgrade=p}a.hasNative=s,a.useNative=t}(wi ndow.CustomElements),function(){function a(a){return"link"===a.localName&&a.getA ttribute("rel")===b}var b=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none" ,c={selectors:["link[rel="+b+"]"],map:{link:"parseLink"},parse:function(a){if(!a .__parsed){a.__parsed=!0;var b=a.querySelectorAll(c.selectors);d(b,function(a){c [c.map[a.localName]](a)}),CustomElements.upgradeDocument(a),CustomElements.obser veDocument(a)}},parseLink:function(b){a(b)&&this.parseImport(b)},parseImport:fun ction(a){a.content&&c.parse(a.content)}},d=Array.prototype.forEach.call.bind(Arr ay.prototype.forEach);CustomElements.parser=c}(),function(){function a(){CustomE lements.parser.parse(document),CustomElements.upgradeDocument(document);var a=wi ndow.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;a(func tion(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLIm ports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),d ocument.body.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))}) }if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b =document.createEvent("HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"== =document.readyState)a();else{var b=window.HTMLImports?"HTMLImportsLoaded":"DOMC ontentLoaded";window.addEventListener(b,a)}}(); 28 window.CustomElements={flags:{}};var SideTable;if("undefined"!=typeof WeakMap&&n avigator.userAgent.indexOf("Firefox/")<0?SideTable=WeakMap:function(){var a=Obje ct.defineProperty,b=Date.now()%1e9;SideTable=function(){this.name="__st"+(1e9*Ma th.random()>>>0)+(b++ +"__")},SideTable.prototype={set:function(b,c){var d=b[thi s.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:functio n(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){th is.set(a,void 0)}}}(),function(a){function b(a){u.push(a),t||(t=!0,q(d))}functio n c(a){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(a) ||a}function d(){t=!1;var a=u;u=[],a.sort(function(a,b){return a.uid_-b.uid_});v ar b=!1;a.forEach(function(a){var c=a.takeRecords();e(a),c.length&&(a.callback_( c,a),b=!0)}),b&&d()}function e(a){a.nodes_.forEach(function(b){var c=p.get(b);c& &c.forEach(function(b){b.observer===a&&b.removeTransientObservers()})})}function f(a,b){for(var c=a;c;c=c.parentNode){var d=p.get(c);if(d)for(var e=0;e<d.length ;e++){var f=d[e],g=f.options;if(c===a||g.subtree){var h=b(g);h&&f.enqueue(h)}}}} function g(a){this.callback_=a,this.nodes_=[],this.records_=[],this.uid_=++v}fun ction h(a,b){this.type=a,this.target=b,this.addedNodes=[],this.removedNodes=[],t his.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attr ibuteNamespace=null,this.oldValue=null}function i(a){var b=new h(a.type,a.target );return b.addedNodes=a.addedNodes.slice(),b.removedNodes=a.removedNodes.slice() ,b.previousSibling=a.previousSibling,b.nextSibling=a.nextSibling,b.attributeName =a.attributeName,b.attributeNamespace=a.attributeNamespace,b.oldValue=a.oldValue ,b}function j(a,b){return w=new h(a,b)}function k(a){return x?x:(x=i(w),x.oldVal ue=a,x)}function l(){w=x=void 0}function m(a){return a===x||a===w}function n(a,b ){return a===b?a:x&&m(a)?x:null}function o(a,b,c){this.observer=a,this.target=b, this.options=c,this.transientObservedNodes=[]}var p=new SideTable,q=window.msSet Immediate;if(!q){var r=[],s=String(Math.random());window.addEventListener("messa ge",function(a){if(a.data===s){var b=r;r=[],b.forEach(function(a){a()})}}),q=fun ction(a){r.push(a),window.postMessage(s,"*")}}var t=!1,u=[],v=0;g.prototype={obs erve:function(a,b){if(a=c(a),!b.childList&&!b.attributes&&!b.characterData||b.at tributeOldValue&&!b.attributes||b.attributeFilter&&b.attributeFilter.length&&!b. attributes||b.characterDataOldValue&&!b.characterData)throw new SyntaxError;var d=p.get(a);d||p.set(a,d=[]);for(var e,f=0;f<d.length;f++)if(d[f].observer===this ){e=d[f],e.removeListeners(),e.options=b;break}e||(e=new o(this,a,b),d.push(e),t his.nodes_.push(a)),e.addListeners()},disconnect:function(){this.nodes_.forEach( function(a){for(var b=p.get(a),c=0;c<b.length;c++){var d=b[c];if(d.observer===th is){d.removeListeners(),b.splice(c,1);break}}},this),this.records_=[]},takeRecor ds:function(){var a=this.records_;return this.records_=[],a}};var w,x;o.prototyp e={enqueue:function(a){var c=this.observer.records_,d=c.length;if(c.length>0){va r e=c[d-1],f=n(e,a);if(f)return c[d-1]=f,void 0}else b(this.observer);c[d]=a},ad dListeners:function(){this.addListeners_(this.target)},addListeners_:function(a) {var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0), b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childL ist&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.a ddEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.remov eListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attr ibutes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.remo veEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventLi stener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListene r("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target ){this.addListeners_(a),this.transientObservedNodes.push(a);var b=p.get(a);b||p. set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transi entObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.remov eListeners_(a);for(var b=p.get(a),c=0;c<b.length;c++)if(b[c]===this){b.splice(c, 1);break}},this)},handleEvent:function(a){switch(a.stopImmediatePropagation(),a. type){case"DOMAttrModified":var b=a.attrName,c=a.relatedNode.namespaceURI,d=a.ta rget,e=new j("attributes",d);e.attributeName=b,e.attributeNamespace=c;var g=a.at trChange===MutationEvent.ADDITION?null:a.prevValue;f(d,function(a){return!a.attr ibutes||a.attributeFilter&&a.attributeFilter.length&&-1===a.attributeFilter.inde xOf(b)&&-1===a.attributeFilter.indexOf(c)?void 0:a.attributeOldValue?k(g):e});br eak;case"DOMCharacterDataModified":var d=a.target,e=j("characterData",d),g=a.pre vValue;f(d,function(a){return a.characterData?a.characterDataOldValue?k(g):e:voi d 0});break;case"DOMNodeRemoved":this.addTransientObserver(a.target);case"DOMNod eInserted":var h,i,d=a.relatedNode,m=a.target;"DOMNodeInserted"===a.type?(h=[m], i=[]):(h=[],i=[m]);var n=m.previousSibling,o=m.nextSibling,e=j("childList",d);e. addedNodes=h,e.removedNodes=i,e.previousSibling=n,e.nextSibling=o,f(d,function(a ){return a.childList?e:void 0})}l()}},a.JsMutationObserver=g}(this),!window.Muta tionObserver&&(window.MutationObserver=window.WebKitMutationObserver||window.JsM utationObserver,!MutationObserver))throw new Error("no mutation observer support ");!function(a){function b(a,c,d){var e=a.firstElementChild;if(!e)for(e=a.firstC hild;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;for(;e;)c(e,d)!==!0&&b(e ,c,d),e=e.nextElementSibling;return null}function c(a,b){for(var c=a.shadowRoot; c;)d(c,b),c=c.olderShadowRoot}function d(a,d){b(a,function(a){return d(a)?!0:(c( a,d),void 0)}),c(a,d)}function e(a){return h(a)?(i(a),!0):(l(a),void 0)}function f(a){d(a,function(a){return e(a)?!0:void 0})}function g(a){return e(a)||f(a)}fu nction h(b){if(!b.__upgraded__&&b.nodeType===Node.ELEMENT_NODE){var c=b.getAttri bute("is")||b.localName,d=a.registry[c];if(d)return y.dom&&console.group("upgrad e:",b.localName),a.upgrade(b),y.dom&&console.groupEnd(),!0}}function i(a){l(a),p (a)&&d(a,function(a){l(a)})}function j(a){if(B.push(a),!A){A=!0;var b=window.Pla tform&&window.Platform.endOfMicrotask||setTimeout;b(k)}}function k(){A=!1;for(va r a,b=B,c=0,d=b.length;d>c&&(a=b[c]);c++)a();B=[]}function l(a){z?j(function(){m (a)}):m(a)}function m(a){(a.enteredViewCallback||a.__upgraded__&&y.dom)&&(y.dom& &console.group("inserted:",a.localName),p(a)&&(a.__inserted=(a.__inserted||0)+1, a.__inserted<1&&(a.__inserted=1),a.__inserted>1?y.dom&&console.warn("inserted:", a.localName,"insert/remove count:",a.__inserted):a.enteredViewCallback&&(y.dom&& console.log("inserted:",a.localName),a.enteredViewCallback())),y.dom&&console.gr oupEnd())}function n(a){o(a),d(a,function(a){o(a)})}function o(a){z?j(function() {_removed(a)}):_removed(a)}function o(a){(a.leftViewCallback||a.__upgraded__&&y. dom)&&(y.dom&&console.log("removed:",a.localName),p(a)||(a.__inserted=(a.__inser ted||0)-1,a.__inserted>0&&(a.__inserted=0),a.__inserted<0?y.dom&&console.warn("r emoved:",a.localName,"insert/remove count:",a.__inserted):a.leftViewCallback&&a. leftViewCallback()))}function p(a){for(var b=a,c=window.ShadowDOMPolyfill&&windo w.ShadowDOMPolyfill.wrapIfNeeded(document)||document;b;){if(b==c)return!0;b=b.pa rentNode||b.host}}function q(a){if(a.shadowRoot&&!a.shadowRoot.__watched){y.dom& &console.log("watching shadow-root for: ",a.localName);for(var b=a.shadowRoot;b; )r(b),b=b.olderShadowRoot}}function r(a){a.__watched||(v(a),a.__watched=!0)}func tion s(a){switch(a.localName){case"style":case"script":case"template":case void 0:return!0}}function t(a){if(y.dom){var b=a[0];if(b&&"childList"===b.type&&b.add edNodes&&b.addedNodes){for(var c=b.addedNodes[0];c&&c!==document&&!c.host;)c=c.p arentNode;var d=c&&(c.URL||c._URL||c.host&&c.host.localName)||"";d=d.split("/?") .shift().split("/").pop()}console.group("mutations (%d) [%s]",a.length,d||"")}a. forEach(function(a){"childList"===a.type&&(D(a.addedNodes,function(a){s(a)||g(a) }),D(a.removedNodes,function(a){s(a)||n(a)}))}),y.dom&&console.groupEnd()}functi on u(){t(C.takeRecords()),k()}function v(a){C.observe(a,{childList:!0,subtree:!0 })}function w(a){v(a)}function x(a){y.dom&&console.group("upgradeDocument: ",(a. URL||a._URL||"").split("/").pop()),g(a),y.dom&&console.groupEnd()}var y=window.l ogFlags||{},z=!window.MutationObserver||window.MutationObserver===window.JsMutat ionObserver;a.hasPolyfillMutations=z;var A=!1,B=[],C=new MutationObserver(t),D=A rray.prototype.forEach.call.bind(Array.prototype.forEach);a.watchShadow=q,a.upgr adeAll=g,a.upgradeSubtree=f,a.observeDocument=w,a.upgradeDocument=x,a.takeRecord s=u}(window.CustomElements),function(a){function b(b,f){var g=f||{};if(!b)throw new Error("document.register: first argument `name` must not be empty");if(b.ind exOf("-")<0)throw new Error("document.register: first argument ('name') must con tain a dash ('-'). Argument provided was '"+String(b)+"'.");if(g.name=b,!g.proto type)throw new Error("Options missing required prototype property");return g.lif ecycle=g.lifecycle||{},g.ancestry=c(g.extends),d(g),e(g),k(g.prototype),m(b,g),g .ctor=n(g),g.ctor.prototype=g.prototype,g.prototype.constructor=g.ctor,a.ready&& a.upgradeAll(document),g.ctor}function c(a){var b=v[a];return b?c(b.extends).con cat([b]):[]}function d(a){for(var b,c=a.extends,d=0;b=a.ancestry[d];d++)c=b.is&& b.tag;a.tag=c||a.name,c&&(a.is=a.name)}function e(a){if(!Object.__proto__){var b =HTMLElement.prototype;if(a.is){var c=document.createElement(a.tag);b=Object.get PrototypeOf(c)}for(var d,e=a.prototype;e&&e!==b;){var d=Object.getPrototypeOf(e) ;e.__proto__=d,e=d}}a.native=b}function f(a){return g(w(a.tag),a)}function g(b,c ){return c.is&&b.setAttribute("is",c.is),h(b,c),b.__upgraded__=!0,a.upgradeSubtr ee(b),j(b),b}function h(a,b){Object.__proto__?a.__proto__=b.prototype:(i(a,b.pro totype,b.native),a.__proto__=b.prototype)}function i(a,b,c){for(var d={},e=b;e!= =c&&e!==HTMLUnknownElement.prototype;){for(var f,g=Object.getOwnPropertyNames(e) ,h=0;f=g[h];h++)d[f]||(Object.defineProperty(a,f,Object.getOwnPropertyDescriptor (e,f)),d[f]=1);e=Object.getPrototypeOf(e)}}function j(a){a.createdCallback&&a.cr eatedCallback()}function k(a){var b=a.setAttribute;a.setAttribute=function(a,c){ l.call(this,a,c,b)};var c=a.removeAttribute;a.removeAttribute=function(a,b){l.ca ll(this,a,b,c)}}function l(a,b,c){var d=this.getAttribute(a);c.apply(this,argume nts),this.attributeChangedCallback&&this.getAttribute(a)!==d&&this.attributeChan gedCallback(a,d)}function m(a,b){if(v[a])throw new Error("Cannot register a tag more than once");v[a]=b}function n(a){return function(){return f(a)}}function o( a,b){var c=v[b||a];if(c){if(a==c.tag&&b==c.is)return new c.ctor;if(!b&&!c.is)ret urn new c.ctor}if(b){var d=o(a);return d.setAttribute("is",b),d}var d=w(a);retur n a.indexOf("-")>=0&&h(d,HTMLElement),d}function p(a){if(!a.__upgraded__&&a.node Type===Node.ELEMENT_NODE){var b=a.getAttribute("is"),c=v[b||a.localName];if(c){i f(b&&c.tag==a.localName)return g(a,c);if(!b&&!c.extends)return g(a,c)}}}function q(b){var c=x.call(this,b);return a.upgradeAll(c),c}a||(a=window.CustomElements= {flags:{}});var r=a.flags,s=Boolean(document.register),t=!r.register&&s;if(t){va r u=function(){};a.registry={},a.upgradeElement=u,a.watchShadow=u,a.upgrade=u,a. upgradeAll=u,a.upgradeSubtree=u,a.observeDocument=u,a.upgradeDocument=u,a.takeRe cords=u}else{var v={},w=document.createElement.bind(document),x=Node.prototype.c loneNode;document.register=b,document.createElement=o,Node.prototype.cloneNode=q ,a.registry=v,a.upgrade=p}a.hasNative=s,a.useNative=t}(window.CustomElements),fu nction(){function a(a){return"link"===a.localName&&a.getAttribute("rel")===b}var b=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",c={selectors:["link[re l="+b+"]"],map:{link:"parseLink"},parse:function(a){if(!a.__parsed){a.__parsed=! 0;var b=a.querySelectorAll(c.selectors);d(b,function(a){c[c.map[a.localName]](a) }),CustomElements.upgradeDocument(a),CustomElements.observeDocument(a)}},parseLi nk:function(b){a(b)&&this.parseImport(b)},parseImport:function(a){a.content&&c.p arse(a.content)}},d=Array.prototype.forEach.call.bind(Array.prototype.forEach);C ustomElements.parser=c}(),function(){function a(){CustomElements.parser.parse(do cument),CustomElements.upgradeDocument(document);var a=window.Platform&&Platform .endOfMicrotask?Platform.endOfMicrotask:setTimeout;a(function(){CustomElements.r eady=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements. elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.body.dispatchEv ent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b=document.createEvent(" HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"===document.readyState)a( );else{var b=window.HTMLImports?"HTMLImportsLoaded":"loading"==document.readySta te?"DOMContentLoaded":"load";window.addEventListener(b,a)}}(),function(){if(HTML Element.prototype.createShadowRoot){var a=HTMLElement.prototype.createShadowRoot ;HTMLElement.prototype.createShadowRoot=function(){var b=a.call(this);return b.h ost=this,b}}}();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698