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

Side by Side Diff: polymer_1.2.3/bower_components/webcomponentsjs/MutationObserver.min.js

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 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
(Empty)
1 /**
2 * @license
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
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
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
9 */
10 // @version 0.7.20
11 "undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now( )%1e9,r=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};r.proto type={set:function(t,r){var i=t[this.name];return i&&i[0]===t?i[1]=r:e(t,this.na me,{value:[t,r],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=r}(),function(e){function t(e){N.push(e),O||(O=!0,b(i))}fu nction r(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeed ed(e)||e}function i(){O=!1;var e=N;N=[],e.sort(function(e,t){return e.uid_-t.uid _});var t=!1;e.forEach(function(e){var r=e.takeRecords();n(e),r.length&&(e.callb ack_(r,e),t=!0)}),t&&i()}function n(e){e.nodes_.forEach(function(t){var r=p.get( t);r&&r.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}fun ction a(e,t){for(var r=e;r;r=r.parentNode){var i=p.get(r);if(i)for(var n=0;n<i.l ength;n++){var a=i[n],s=a.options;if(r===e||s.subtree){var o=t(s);o&&a.enqueue(o )}}}}function s(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++ M}function o(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 d(e){var t=new o(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 D=new o(e,t)}function h(e){return w?w:(w=d(D),w.o ldValue=e,w)}function c(){D=w=void 0}function v(e){return e===w||e===D}function l(e,t){return e===t?e:w&&v(e)?w:null}function f(e,t,r){this.observer=e,this.targ et=t,this.options=r,this.transientObservedNodes=[]}if(!e.JsMutationObserver){var b,p=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))b=setTimeout;else i f(window.setImmediate)b=window.setImmediate;else{var g=[],m=String(Math.random() );window.addEventListener("message",function(e){if(e.data===m){var t=g;g=[],t.fo rEach(function(e){e()})}}),b=function(e){g.push(e),window.postMessage(m,"*")}}va r O=!1,N=[],M=0;s.prototype={observe:function(e,t){if(e=r(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 i=p.get(e);i||p.set(e,i=[]);for(var n,a=0;a<i.le ngth;a++)if(i[a].observer===this){n=i[a],n.removeListeners(),n.options=t;break}n ||(n=new f(this,e,t),i.push(n),this.nodes_.push(e)),n.addListeners()},disconnect :function(){this.nodes_.forEach(function(e){for(var t=p.get(e),r=0;r<t.length;r+ +){var i=t[r];if(i.observer===this){i.removeListeners(),t.splice(r,1);break}}},t his),this.records_=[]},takeRecords:function(){var e=this.records_;return this.re cords_=[],e}};var D,w;f.prototype={enqueue:function(e){var r=this.observer.recor ds_,i=r.length;if(r.length>0){var n=r[i-1],a=l(n,e);if(a)return void(r[i-1]=a)}e lse t(this.observer);r[i]=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=p.get(e);t||p.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=p.get(e),r=0;r<t.length; r++)if(t[r]===this){t.splice(r,1);break}},this)},handleEvent:function(e){switch( e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,r=e. relatedNode.namespaceURI,i=e.target,n=new u("attributes",i);n.attributeName=t,n. attributeNamespace=r;var s=e.attrChange===MutationEvent.ADDITION?null:e.prevValu e;a(i,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.leng th&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(r)?void 0: e.attributeOldValue?h(s):n});break;case"DOMCharacterDataModified":var i=e.target ,n=u("characterData",i),s=e.prevValue;a(i,function(e){return e.characterData?e.c haracterDataOldValue?h(s):n:void 0});break;case"DOMNodeRemoved":this.addTransien tObserver(e.target);case"DOMNodeInserted":var o,d,v=e.target;"DOMNodeInserted"== =e.type?(o=[v],d=[]):(o=[],d=[v]);var l=v.previousSibling,f=v.nextSibling,n=u("c hildList",e.target.parentNode);n.addedNodes=o,n.removedNodes=d,n.previousSibling =l,n.nextSibling=f,a(e.relatedNode,function(e){return e.childList?n:void 0})}c() }},e.JsMutationObserver=s,e.MutationObserver||(e.MutationObserver=s,s._isPolyfil led=!0)}}(self);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698