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

Side by Side Diff: lib/shadowdom.min.js

Issue 22962005: Merge pull request #581 from kevmoo/polymer (Closed) Base URL: https://github.com/dart-lang/web-ui.git@polymer
Patch Set: Created 7 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
« no previous file with comments | « lib/shadowdom.debug.js ('k') | lib/src/analyzer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateS hadowRoot||window.__forceShadowDomPolyfill){(function(){Element.prototype.webkit CreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return wi ndow.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})})();var SideTable ;"undefined"!=typeof WeakMap&&0>navigator.userAgent.indexOf("Firefox/")?SideTabl e=WeakMap:function(){var e=Object.defineProperty,t=Object.hasOwnProperty,n=(new Date).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0 )+(n++ +"__")},SideTable.prototype={set:function(t,n){e(t,this.name,{value:n,wri table:!0})},get:function(e){return t.call(e,this.name)?e[this.name]:void 0},"del ete":function(e){this.set(e,void 0)}}}();var ShadowDOMPolyfill={};(function(e){" use strict";function t(e){if(!e)throw new Error("Assertion failed")}function n(e ,t){return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProper ty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function r(e,t){return Object.g etOwnPropertyNames(t).forEach(function(n){switch(n){case"arguments":case"caller" :case"length":case"name":case"prototype":case"toString":return}Object.defineProp erty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function i(e){var t=e.__proto __||Object.getPrototypeOf(e),n=M.get(t);if(n)return n;var r=i(t),o=p(r);return u (t,o,e),o}function o(e,t){l(e,t,!0)}function a(e,t){l(t,e,!1)}function l(e,t,n){ Object.getOwnPropertyNames(e).forEach(function(r){if(!(r in t)){L&&e.__lookupGet ter__(r);var i;try{i=Object.getOwnPropertyDescriptor(e,r)}catch(o){i=C}var a,l;i f(n&&"function"==typeof i.value)return t[r]=function(){return this.impl[r].apply (this.impl,arguments)},void 0;a=function(){return this.impl[r]},(i.writable||i.s et)&&(l=function(e){this.impl[r]=e}),Object.defineProperty(t,r,{get:a,set:l,conf igurable:i.configurable,enumerable:i.enumerable})}})}function s(e,t,n){var i=e.p rototype;u(i,t,n),r(t,e)}function u(e,n,r){var i=n.prototype;t(void 0===M.get(e) ),M.set(e,n),o(e,i),r&&a(i,r)}function c(e,t){return M.get(t.prototype)===e}func tion d(e){var t=Object.getPrototypeOf(e),n=i(t),r=p(n);return u(t,r,e),r}functio n p(e){function t(t){e.call(this,t)}return t.prototype=Object.create(e.prototype ),t.prototype.constructor=t,t}function f(e){return e instanceof N.EventTarget||e instanceof N.Event||e instanceof N.DOMImplementation}function h(e){return e ins tanceof D||e instanceof O||e instanceof _||e instanceof H}function m(e){if(null= ==e)return null;t(h(e));var n=S.get(e);if(!n){var r=i(e);n=new r(e),S.set(e,n)}r eturn n}function w(e){return null===e?null:(t(f(e)),e.impl)}function g(e){return e&&f(e)?w(e):e}function v(e){return e&&!f(e)?m(e):e}function E(e,n){null!==n&&( t(h(e)),t(void 0===n||f(n)),S.set(e,n))}function y(e,t,n){Object.defineProperty( e.prototype,t,{get:n,configurable:!0,enumerable:!0})}function T(e,t){y(e,t,funct ion(){return m(this.impl[t])})}function b(e,t){e.forEach(function(e){t.forEach(f unction(t){e.prototype[t]=function(){var e=m(this);return e[t].apply(e,arguments )}})})}var S=new SideTable,M=new SideTable,N=Object.create(null);Object.getOwnPr opertyNames(window);var L=/Firefox/.test(navigator.userAgent),C={get:function(){ },set:function(){},configurable:!0,enumerable:!0},H=DOMImplementation,O=Event,D= Node,_=Window;e.assert=t,e.defineGetter=y,e.defineWrapGetter=T,e.forwardMethodsT oWrapper=b,e.isWrapper=f,e.isWrapperFor=c,e.mixin=n,e.registerObject=d,e.registe rWrapper=s,e.rewrap=E,e.unwrap=w,e.unwrapIfNeeded=g,e.wrap=m,e.wrapIfNeeded=v,e. wrappers=N})(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){retu rn e instanceof I.ShadowRoot}function n(e){var t=e.localName;return"content"===t ||"shadow"===t}function r(e){return!!e.shadowRoot}function i(e){var t;return e.p arentNode||(t=e.defaultView)&&R(t)||null}function o(o,a,l){if(l.length)return l. shift();if(t(o))return o.insertionParent||e.getHostForShadowRoot(o);var s=e.even tParentsTable.get(o);if(s){for(var u=1;s.length>u;u++)l[u-1]=s[u];return s[0]}if (a&&n(o)){var c=o.parentNode;if(c&&r(c))for(var d=e.getShadowTrees(c),p=a.insert ionParent,u=0;d.length>u;u++)if(d[u].contains(p))return p}return i(o)}function a (e){for(var r=[],i=e,a=[],s=[];i;){var u=null;if(n(i)){u=l(r);var c=r[r.length-1 ]||i;r.push(c)}else r.length||r.push(i);var d=r[r.length-1];a.push({target:d,cur rentTarget:i}),t(i)&&r.pop(),i=o(i,u,s)}return a}function l(e){for(var t=e.lengt h-1;t>=0;t--)if(!n(e[t]))return e[t];return null}function s(r,i){for(var a=[];r; ){for(var s=[],c=i,p=void 0;c;){var f=null;if(s.length){if(n(c)&&(f=l(s),u(p))){ var h=s[s.length-1];s.push(h)}}else s.push(c);if(d(c,r))return s[s.length-1];t(c )&&s.pop(),p=c,c=o(c,f,a)}r=t(r)?e.getHostForShadowRoot(r):r.parentNode}}functio n u(e){return e.insertionParent}function c(e){for(var t;t=e.parentNode;)e=t;retu rn e}function d(e,t){return c(e)===c(t)}function p(e){switch(e){case"DOMAttrModi fied":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMEleme ntNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMN odeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}r eturn!1}function f(t){if(!F.get(t)){F.set(t,!0),p(t.type)||e.renderAllPending(); var n=R(t.target),r=R(t);return h(r,n)}}function h(e,t){var n=a(t);return"load"= ==e.type&&2===n.length&&n[0].target instanceof I.Document&&n.shift(),m(e,n)&&w(e ,n)&&g(e,n),k.set(e,y.NONE),W.set(e,null),e.defaultPrevented}function m(e,t){for (var n,r=t.length-1;r>0;r--){var i=t[r].target,o=t[r].currentTarget;if(i!==o&&(n =y.CAPTURING_PHASE,!v(t[r],e,n)))return!1}return!0}function w(e,t){var n=y.AT_TA RGET;return v(t[0],e,n)}function g(e,t){for(var n,r=e.bubbles,i=1;t.length>i;i++ ){var o=t[i].target,a=t[i].currentTarget;if(o===a)n=y.AT_TARGET;else{if(!r||q.ge t(e))continue;n=y.BUBBLING_PHASE}if(!v(t[i],e,n))return}}function v(e,t,n){var r =e.target,i=e.currentTarget,o=A.get(i);if(!o)return!0;if("relatedTarget"in t){va r a=x(t),l=R(a.relatedTarget),u=s(i,l);if(u===r)return!0;B.set(t,u)}k.set(t,n);v ar c=t.type,d=!1;j.set(t,r),W.set(t,i);for(var p=0;o.length>p;p++){var f=o[p];if (f.removed)d=!0;else if(!(f.type!==c||!f.capture&&n===y.CAPTURING_PHASE||f.captu re&&n===y.BUBBLING_PHASE))try{if("function"==typeof f.handler?f.handler.call(i,t ):f.handler.handleEvent(t),q.get(t))return!1}catch(h){window.onerror?window.oner ror(h.message):console.error(h)}}if(d){var m=o.slice();o.length=0;for(var p=0;m. length>p;p++)m[p].removed||o.push(m[p])}return!G.get(t)}function E(e,t,n){this.t ype=e,this.handler=t,this.capture=Boolean(n)}function y(e,t){return e instanceof U?(this.impl=e,void 0):R(M(U,"Event",e,t))}function T(e){return e&&e.relatedTar get?Object.create(e,{relatedTarget:{value:x(e.relatedTarget)}}):e}function b(e,t ,n){var r=window[e],i=function(t,n){return t instanceof r?(this.impl=t,void 0):R (M(r,e,t,n))};return i.prototype=Object.create(t.prototype),n&&_(i.prototype,n), r&&P(r,i,document.createEvent(e)),i}function S(e,t){return function(){arguments[ t]=x(arguments[t]);var n=x(this);n[e].apply(n,arguments)}}function M(e,t,n,r){if (et)return new e(n,T(r));var i=x(document.createEvent(t)),o=J[t],a=[n];return Ob ject.keys(o).forEach(function(e){var t=null!=r&&e in r?r[e]:o[e];"relatedTarget" ===e&&(t=x(t)),a.push(t)}),i["init"+t].apply(i,a),i}function N(e){return"functio n"==typeof e?!0:e&&e.handleEvent}function L(e){this.impl=e}function C(t){return t instanceof I.ShadowRoot&&(t=e.getHostForShadowRoot(t)),x(t)}function H(e){D(e, rt)}function O(t,n,r,i){e.renderAllPending();for(var o=R(it.call(n.impl,r,i)),l= a(o,this),s=0;l.length>s;s++){var u=l[s];if(u.currentTarget===t)return u.target} return null}var D=e.forwardMethodsToWrapper,_=e.mixin,P=e.registerWrapper,x=e.un wrap,R=e.wrap,I=e.wrappers;new SideTable;var A=new SideTable,F=new SideTable,j=n ew SideTable,W=new SideTable,B=new SideTable,k=new SideTable,G=new SideTable,q=n ew SideTable;E.prototype={equals:function(e){return this.handler===e.handler&&th is.type===e.type&&this.capture===e.capture},get removed(){return null===this.han dler},remove:function(){this.handler=null}};var U=window.Event;y.prototype={get target(){return j.get(this)},get currentTarget(){return W.get(this)},get eventPh ase(){return k.get(this)},stopPropagation:function(){G.set(this,!0)},stopImmedia tePropagation:function(){G.set(this,!0),q.set(this,!0)}},P(U,y,document.createEv ent("Event"));var $=b("UIEvent",y),V=b("CustomEvent",y),K={get relatedTarget(){r eturn B.get(this)||R(x(this).relatedTarget)}},z=_({initMouseEvent:S("initMouseEv ent",14)},K),X=_({initFocusEvent:S("initFocusEvent",5)},K),Y=b("MouseEvent",$,z) ,Q=b("FocusEvent",$,X),Z=b("MutationEvent",y,{initMutationEvent:S("initMutationE vent",3),get relatedNode(){return R(this.impl.relatedNode)}}),J=Object.create(nu ll),et=function(){try{new window.MouseEvent("click")}catch(e){return!1}return!0} ();if(!et){var tt=function(e,t,n){if(n){var r=J[n];t=_(_({},r),t)}J[e]=t};tt("Ev ent",{bubbles:!1,cancelable:!1}),tt("CustomEvent",{detail:null},"Event"),tt("UIE vent",{view:null,detail:0},"Event"),tt("MouseEvent",{screenX:0,screenY:0,clientX :0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget: null},"UIEvent"),tt("FocusEvent",{relatedTarget:null},"UIEvent")}var nt=window.E ventTarget,rt=["addEventListener","removeEventListener","dispatchEvent"];[Elemen t,Window,Document].forEach(function(e){var t=e.prototype;rt.forEach(function(e){ Object.defineProperty(t,e+"_",{value:t[e]})})}),L.prototype={addEventListener:fu nction(e,t,n){if(N(t)){var r=new E(e,t,n),i=A.get(this);if(i){for(var o=0;i.leng th>o;o++)if(r.equals(i[o]))return}else i=[],A.set(this,i);i.push(r);var a=C(this );a.addEventListener_(e,f,!0)}},removeEventListener:function(e,t,n){n=Boolean(n) ;var r=A.get(this);if(r){for(var i=0,o=!1,a=0;r.length>a;a++)r[a].type===e&&r[a] .capture===n&&(i++,r[a].handler===t&&(o=!0,r[a].remove()));if(o&&1===i){var l=C( this);l.removeEventListener_(e,f,!0)}}},dispatchEvent:function(t){e.renderAllPen ding();var n=C(this);return n.dispatchEvent_(x(t))}},nt&&P(nt,L);var it=document .elementFromPoint;e.adjustRelatedTarget=s,e.elementFromPoint=O,e.wrapEventTarget Methods=H,e.wrappers.CustomEvent=V,e.wrappers.Event=y,e.wrappers.EventTarget=L,e .wrappers.FocusEvent=Q,e.wrappers.MouseEvent=Y,e.wrappers.MutationEvent=Z,e.wrap pers.UIEvent=$}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e,t) {Object.defineProperty(e,t,{enumerable:!1})}function n(){this.length=0,t(this,"l ength")}function r(e){if(null==e)return e;for(var t=new n,r=0,i=e.length;i>r;r++ )t[r]=o(e[r]);return t.length=i,t}function i(e,t){e.prototype[t]=function(){retu rn r(this.impl[t].apply(this.impl,arguments))}}var o=e.wrap;n.prototype={item:fu nction(e){return this[e]}},t(n.prototype,"item"),e.wrappers.NodeList=n,e.addWrap NodeListMethod=i,e.wrapNodeList=r}(this.ShadowDOMPolyfill),function(e){"use stri ct";function t(e){u(e instanceof o)}function n(e,t,n,r){if(e.nodeType!==o.DOCUME NT_FRAGMENT_NODE)return e.parentNode&&e.parentNode.removeChild(e),e.parentNode_= t,e.previousSibling_=n,e.nextSibling_=r,n&&(n.nextSibling_=e),r&&(r.previousSibl ing_=e),[e];for(var i,a=[];i=e.firstChild;)e.removeChild(i),a.push(i),i.parentNo de_=t;for(var l=0;a.length>l;l++)a[l].previousSibling_=a[l-1]||n,a[l].nextSiblin g_=a[l+1]||r;return n&&(n.nextSibling_=a[0]),r&&(r.previousSibling_=a[a.length-1 ]),a}function r(e){if(1===e.length)return p(e[0]);for(var t=p(document.createDoc umentFragment()),n=0;e.length>n;n++)t.appendChild(p(e[n]));return t}function i(e ){for(var t=e.firstChild;t;){u(t.parentNode===e);var n=t.nextSibling,r=p(t),i=r. parentNode;i&&v.call(i,r),t.previousSibling_=t.nextSibling_=t.parentNode_=null,t =n}e.firstChild_=e.lastChild_=null}function o(e){u(e instanceof h),a.call(this,e ),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.ne xtSibling_=void 0,this.previousSibling_=void 0}var a=e.wrappers.EventTarget,l=e. wrappers.NodeList,s=e.defineWrapGetter,u=e.assert,c=e.mixin,d=e.registerWrapper, p=e.unwrap,f=e.wrap,h=window.Node,m=h.prototype.appendChild,w=h.prototype.insert Before,g=h.prototype.replaceChild,v=h.prototype.removeChild,E=h.prototype.compar eDocumentPosition;o.prototype=Object.create(a.prototype),c(o.prototype,{appendCh ild:function(e){t(e),this.invalidateShadowRenderer();var i=this.lastChild,o=null ,a=n(e,this,i,o);return this.lastChild_=a[a.length-1],i||(this.firstChild_=a[0]) ,m.call(this.impl,r(a)),e},insertBefore:function(e,i){if(!i)return this.appendCh ild(e);t(e),t(i),u(i.parentNode===this),this.invalidateShadowRenderer();var o=i. previousSibling,a=i,l=n(e,this,o,a);this.firstChild===i&&(this.firstChild_=l[0]) ;var s=p(i),c=s.parentNode;return c&&w.call(c,r(l),s),e},removeChild:function(e) {if(t(e),e.parentNode!==this)throw new Error("NotFoundError");this.invalidateSha dowRenderer();var n=this.firstChild,r=this.lastChild,i=e.nextSibling,o=e.previou sSibling,a=p(e),l=a.parentNode;return l&&v.call(l,a),n===e&&(this.firstChild_=i) ,r===e&&(this.lastChild_=o),o&&(o.nextSibling_=i),i&&(i.previousSibling_=o),e.pr eviousSibling_=e.nextSibling_=e.parentNode_=null,e},replaceChild:function(e,i){i f(t(e),t(i),i.parentNode!==this)throw new Error("NotFoundError");this.invalidate ShadowRenderer();var o=i.previousSibling,a=i.nextSibling;a===e&&(a=e.nextSibling );var l=n(e,this,o,a);this.firstChild===i&&(this.firstChild_=l[0]),this.lastChil d===i&&(this.lastChild_=l[l.length-1]),i.previousSibling_=null,i.nextSibling_=nu ll,i.parentNode_=null;var s=p(i);return s.parentNode&&g.call(s.parentNode,r(l),s ),i},hasChildNodes:function(){return null===this.firstChild},get parentNode(){re turn void 0!==this.parentNode_?this.parentNode_:f(this.impl.parentNode)},get fir stChild(){return void 0!==this.firstChild_?this.firstChild_:f(this.impl.firstChi ld)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:f(this.impl .lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSiblin g_:f(this.impl.nextSibling)},get previousSibling(){return void 0!==this.previous Sibling_?this.previousSibling_:f(this.impl.previousSibling)},get parentElement() {for(var e=this.parentNode;e&&e.nodeType!==o.ELEMENT_NODE;)e=e.parentNode;return e},get textContent(){for(var e="",t=this.firstChild;t;t=t.nextSibling)e+=t.text Content;return e},set textContent(e){if(i(this),this.invalidateShadowRenderer(), ""!==e){var t=this.impl.ownerDocument.createTextNode(e);this.appendChild(t)}},ge t childNodes(){for(var e=new l,t=0,n=this.firstChild;n;n=n.nextSibling)e[t++]=n; return e.length=t,e},cloneNode:function(e){if(!this.invalidateShadowRenderer())r eturn f(this.impl.cloneNode(e));var t=f(this.impl.cloneNode(!1));if(e)for(var n= this.firstChild;n;n=n.nextSibling)t.appendChild(n.cloneNode(!0));return t},conta ins:function(e){if(!e)return!1;if(e===this)return!0;var t=e.parentNode;return t? this.contains(t):!1},compareDocumentPosition:function(e){return E.call(this.impl ,p(e))}}),s(o,"ownerDocument"),d(h,o,document.createDocumentFragment()),delete o .prototype.querySelector,delete o.prototype.querySelectorAll,o.prototype=c(Objec t.create(a.prototype),o.prototype),e.wrappers.Node=o}(this.ShadowDOMPolyfill),fu nction(e){"use strict";function t(e,n){for(var r,i=e.firstElementChild;i;){if(i. matches(n))return i;if(r=t(i,n))return r;i=i.nextElementSibling}return null}func tion n(e,t,r){for(var i=e.firstElementChild;i;)i.matches(t)&&(r[r.length++]=i),n (i,t,r),i=i.nextElementSibling;return r}var r={querySelector:function(e){return t(this,e)},querySelectorAll:function(e){return n(this,e,new NodeList)}},i={getEl ementsByTagName:function(e){return this.querySelectorAll(e)},getElementsByClassN ame:function(e){return this.querySelectorAll("."+e)},getElementsByTagNameNS:func tion(e,t){if("*"===e)return this.getElementsByTagName(t);for(var n=new NodeList, r=this.getElementsByTagName(t),i=0,o=0;r.length>i;i++)r[i].namespaceURI===e&&(n[ o++]=r[i]);return n.length=o,n}};e.GetElementsByInterface=i,e.SelectorsInterface =r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){for(;e&&e.nod eType!==Node.ELEMENT_NODE;)e=e.nextSibling;return e}function n(e){for(;e&&e.node Type!==Node.ELEMENT_NODE;)e=e.previousSibling;return e}var r=e.wrappers.NodeList ,i={get firstElementChild(){return t(this.firstChild)},get lastElementChild(){re turn n(this.lastChild)},get childElementCount(){for(var e=0,t=this.firstElementC hild;t;t=t.nextElementSibling)e++;return e},get children(){for(var e=new r,t=0,n =this.firstElementChild;n;n=n.nextElementSibling)e[t++]=n;return e.length=t,e}}, o={get nextElementSibling(){return t(this.nextSibling)},get previousElementSibli ng(){return n(this.nextSibling)}};e.ChildNodeInterface=o,e.ParentNodeInterface=i }(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)} var n=e.ChildNodeInterface,r=e.wrappers.Node,i=e.mixin,o=e.registerWrapper,a=win dow.CharacterData;t.prototype=Object.create(r.prototype),i(t.prototype,{get text Content(){return this.data},set textContent(e){this.data=e}}),i(t.prototype,n),o (a,t,document.createTextNode("")),e.wrappers.CharacterData=t}(this.ShadowDOMPoly fill),function(e){"use strict";function t(e){i.call(this,e)}var n=e.ChildNodeInt erface,r=e.GetElementsByInterface,i=e.wrappers.Node,o=e.ParentNodeInterface,a=e. SelectorsInterface;e.addWrapNodeListMethod;var l=e.mixin,s=e.registerWrapper,u=e .wrappers,c=new SideTable,d=window.Element,p=d.prototype.matches||d.prototype.mo zMatchesSelector||d.prototype.msMatchesSelector||d.prototype.webkitMatchesSelect or;t.prototype=Object.create(i.prototype),l(t.prototype,{createShadowRoot:functi on(){var t=new u.ShadowRoot(this);return c.set(this,t),e.getRendererForHost(this ),this.invalidateShadowRenderer(!0),t},get shadowRoot(){return c.get(this)||null },setAttribute:function(e,t){this.impl.setAttribute(e,t),this.invalidateShadowRe nderer()},matches:function(e){return p.call(this.impl,e)}}),l(t.prototype,n),l(t .prototype,r),l(t.prototype,o),l(t.prototype,a),s(d,t),e.wrappers.Element=t}(thi s.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e){case"&":re turn"&amp;";case"<":return"&lt;";case'"':return"&quot;"}}function n(e){return e. replace(m,t)}function r(e){switch(e.nodeType){case Node.ELEMENT_NODE:for(var t,r =e.tagName.toLowerCase(),o="<"+r,a=e.attributes,l=0;t=a[l];l++)o+=" "+t.name+'=" '+n(t.value)+'"';return o+=">",w[r]?o:o+i(e)+"</"+r+">";case Node.TEXT_NODE:retu rn n(e.nodeValue);case Node.COMMENT_NODE:return"<!--"+n(e.nodeValue)+"-->";defau lt:throw console.error(e),new Error("not implemented")}}function i(e){for(var t= "",n=e.firstChild;n;n=n.nextSibling)t+=r(n);return t}function o(e,t,n){var r=n|| "div";e.textContent="";var i=f(e.ownerDocument.createElement(r));i.innerHTML=t;f or(var o;o=i.firstChild;)e.appendChild(h(o))}function a(e){u.call(this,e)}functi on l(t){c(a,t,function(){return e.renderAllPending(),this.impl[t]})}function s(t ){Object.defineProperty(a.prototype,t,{value:function(){return e.renderAllPendin g(),this.impl[t].apply(this.impl,arguments)},configurable:!0,enumerable:!0})}var u=e.wrappers.Element,c=e.defineGetter,d=e.mixin,p=e.registerWrapper,f=e.unwrap, h=e.wrap,m=/&|<|"/g,w={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,im g:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},g=wi ndow.HTMLElement;a.prototype=Object.create(u.prototype),d(a.prototype,{get inner HTML(){return i(this)},set innerHTML(e){o(this,e,this.tagName)},get outerHTML(){ return r(this)},set outerHTML(e){if(this.invalidateShadowRenderer())throw new Er ror("not implemented");this.impl.outerHTML=e}}),["clientHeight","clientLeft","cl ientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","sc rollHeight","scrollLeft","scrollTop","scrollWidth"].forEach(l),["getBoundingClie ntRect","getClientRects","scrollIntoView"].forEach(s),p(g,a,document.createEleme nt("b")),e.wrappers.HTMLElement=a,e.getInnerHTML=i,e.setInnerHTML=o}(this.Shadow DOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrapp ers.HTMLElement,r=e.mixin,i=e.registerWrapper,o=window.HTMLContentElement;t.prot otype=Object.create(n.prototype),r(t.prototype,{get select(){return this.getAttr ibute("select")},set select(e){this.setAttribute("select",e)},setAttribute:funct ion(e,t){n.prototype.setAttribute.call(this,e,t),"select"===String(e).toLowerCas e()&&this.invalidateShadowRenderer(!0)}}),o&&i(o,t),e.wrappers.HTMLContentElemen t=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this, e),this.olderShadowRoot_=null}var n=e.wrappers.HTMLElement,r=e.mixin,i=e.registe rWrapper,o=window.HTMLShadowElement;t.prototype=Object.create(n.prototype),r(t.p rototype,{get olderShadowRoot(){return this.olderShadowRoot_},invalidateShadowRe nderer:function(){n.prototype.invalidateShadowRenderer.call(this,!0)}}),o&&i(o,t ),e.wrappers.HTMLShadowElement=t}(this.ShadowDOMPolyfill),function(e){"use stric t";function t(e){if(!e.defaultView)return e;var t=d.get(e);if(!t){for(t=e.implem entation.createHTMLDocument("");t.lastChild;)t.removeChild(t.lastChild);d.set(e, t)}return t}function n(e){for(var n,r=t(e.ownerDocument),i=r.createDocumentFragm ent();n=e.firstChild;)i.appendChild(n);return i}function r(e){i.call(this,e)}var i=e.wrappers.HTMLElement,o=e.getInnerHTML,a=e.mixin,l=e.registerWrapper,s=e.set InnerHTML,u=e.wrap,c=new SideTable,d=new SideTable,p=window.HTMLTemplateElement; r.prototype=Object.create(i.prototype),a(r.prototype,{get content(){if(p)return u(this.impl.content);var e=c.get(this);return e||(e=n(this),c.set(this,e)),e},ge t innerHTML(){return o(this.content)},set innerHTML(e){s(this.content,e),this.in validateShadowRenderer()}}),p&&l(p,r),e.wrappers.HTMLTemplateElement=r}(this.Sha dowDOMPolyfill),function(e){"use strict";function t(e){switch(e.localName){case" content":return new n(e);case"shadow":return new i(e);case"template":return new o(e)}r.call(this,e)}var n=e.wrappers.HTMLContentElement,r=e.wrappers.HTMLElement ,i=e.wrappers.HTMLShadowElement,o=e.wrappers.HTMLTemplateElement;e.mixin;var a=e .registerWrapper,l=window.HTMLUnknownElement;t.prototype=Object.create(r.prototy pe),a(l,t),e.wrappers.HTMLUnknownElement=t}(this.ShadowDOMPolyfill),function(e){ "use strict";var t=e.GetElementsByInterface,n=e.ParentNodeInterface,r=e.Selector sInterface,i=e.mixin,o=e.registerObject,a=o(document.createDocumentFragment());i (a.prototype,n),i(a.prototype,r),i(a.prototype,t);var l=o(document.createTextNod e("")),s=o(document.createComment(""));e.wrappers.Comment=s,e.wrappers.DocumentF ragment=a,e.wrappers.Text=l}(this.ShadowDOMPolyfill),function(e){"use strict";fu nction t(t){var r=s(t.impl.ownerDocument.createDocumentFragment());n.call(this,r ),a(r,this);var i=t.shadowRoot;e.nextOlderShadowTreeTable.set(this,i),u.set(this ,t)}var n=e.wrappers.DocumentFragment,r=e.elementFromPoint,i=e.getInnerHTML,o=e. mixin,a=e.rewrap,l=e.setInnerHTML,s=e.unwrap,u=new SideTable;t.prototype=Object. create(n.prototype),o(t.prototype,{get innerHTML(){return i(this)},set innerHTML (e){l(this,e),this.invalidateShadowRenderer()},invalidateShadowRenderer:function (){return u.get(this).invalidateShadowRenderer()},elementFromPoint:function(e,t) {return r(this,this.ownerDocument,e,t)},getElementById:function(e){return this.q uerySelector("#"+e)}}),e.wrappers.ShadowRoot=t,e.getHostForShadowRoot=function(e ){return u.get(e)}}(this.ShadowDOMPolyfill),function(e){"use strict";function t( e){e.previousSibling_=e.previousSibling,e.nextSibling_=e.nextSibling,e.parentNod e_=e.parentNode}function n(e){e.firstChild_=e.firstChild,e.lastChild_=e.lastChil d}function r(e){_(e instanceof D);for(var r=e.firstChild;r;r=r.nextSibling)t(r); n(e)}function i(e){var t=x(e);r(e),t.textContent=""}function o(e,n){var i=x(e),o =x(n);o.nodeType===D.DOCUMENT_FRAGMENT_NODE?r(n):(l(n),t(n)),e.lastChild_=e.last Child,e.lastChild===e.firstChild&&(e.firstChild_=e.firstChild);var a=R(i.lastChi ld);a&&(a.nextSibling_=a.nextSibling),i.appendChild(o)}function a(e,n){var r=x(e ),i=x(n);t(n),n.previousSibling&&(n.previousSibling.nextSibling_=n),n.nextSiblin g&&(n.nextSibling.previousSibling_=n),e.lastChild===n&&(e.lastChild_=n),e.firstC hild===n&&(e.firstChild_=n),r.removeChild(i)}function l(e){var t=x(e),n=t.parent Node;n&&a(R(n),e)}function s(e,t){c(t).push(e),F.set(e,t);var n=A.get(e);n||A.se t(e,n=[]),n.push(t)}function u(e){I.set(e,[])}function c(e){return I.get(e)}func tion d(e){for(var t=[],n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t}fu nction p(e,t,n){for(var r=d(e),i=0;r.length>i;i++){var o=r[i];if(t(o)){if(n(o)== =!1)return}else p(o,t,n)}}function f(e,t){var n=!1;return p(e,y,function(e){u(e) ;for(var r=0;t.length>r;r++){var i=t[r];void 0!==i&&m(i,e)&&(s(i,e),t[r]=void 0, n=!0)}}),n?t.filter(function(e){return void 0!==e}):t}function h(e,t){for(var n= 0;t.length>n;n++)if(t[n]in e)return t[n]}function m(e,t){var n=t.getAttribute("s elect");if(!n)return!0;if(n=n.trim(),!n)return!0;if(e.nodeType!==D.ELEMENT_NODE) return!1;if(!k.test(n))return!1;if(":"===n[0]&&!G.test(n))return!1;try{return e. matches(n)}catch(r){return!1}}function w(){H=null,U.forEach(function(e){e.render ()}),U=[]}function g(e){this.host=e,this.dirty=!1,this.associateNode(e)}function v(e){var t=W.get(e);return t||(t=new g(e),W.set(e,t)),t}function E(e){return"co ntent"===e.localName}function y(e){return"content"===e.localName}function T(e){r eturn"shadow"===e.localName}function b(e){return"shadow"===e.localName}function S(e){return!!e.shadowRoot}function M(e){return j.get(e)}function N(e){for(var t= [],n=e.shadowRoot;n;n=j.get(n))t.push(n);return t}function L(e,t){F.set(e,t)}fun ction C(e){new g(e).render()}var H,O=e.wrappers.HTMLContentElement,D=e.wrappers. Node,_=e.assert,P=e.mixin,x=e.unwrap,R=e.wrap,I=new SideTable,A=new SideTable,F= new SideTable,j=new SideTable,W=new SideTable,B=new SideTable,k=/^[*.:#[a-zA-Z_| ]/,G=new RegExp("^:("+["link","visited","target","enabled","disabled","checked", "indeterminate","nth-child","nth-last-child","nth-of-type","nth-last-of-type","f irst-child","last-child","first-of-type","last-of-type","only-of-type"].join("|" )+")"),q=h(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitReq uestAnimationFrame","setTimeout"]),U=[];g.prototype={render:function(){if(this.d irty){var e=this.host;this.treeComposition();var t=e.shadowRoot;if(t){this.remov eAllChildNodes(this.host);var n=d(t);n.forEach(function(n){this.renderNode(e,t,n ,!1)},this),this.dirty=!1}}},invalidate:function(){if(!this.dirty){if(this.dirty =!0,U.push(this),H)return;H=window[q](w,0)}},renderNode:function(e,t,n,r){if(S(n )){this.appendChild(e,n);var i=v(n);i.dirty=!0,i.render()}else E(n)?this.renderI nsertionPoint(e,t,n,r):T(n)?this.renderShadowInsertionPoint(e,t,n):this.renderAs AnyDomTree(e,t,n,r)},renderAsAnyDomTree:function(e,t,n,r){if(this.appendChild(e, n),S(n))C(n);else{var i=n,o=d(i);o.forEach(function(e){this.renderNode(i,t,e,r)} ,this)}},renderInsertionPoint:function(e,t,n,r){var i=c(n);i.length?(this.remove AllChildNodes(n),i.forEach(function(n){E(n)&&r?this.renderInsertionPoint(e,t,n,r ):this.renderAsAnyDomTree(e,t,n,r)},this)):this.renderFallbackContent(e,n),this. remove(n)},renderShadowInsertionPoint:function(e,t,n){var r=M(t);if(r){F.set(r,n ),n.olderShadowRoot_=r,this.remove(n);var i=d(r);i.forEach(function(t){this.rend erNode(e,r,t,!0)},this)}else this.renderFallbackContent(e,n)},renderFallbackCont ent:function(e,t){var n=d(t);n.forEach(function(t){this.appendChild(e,t)},this)} ,treeComposition:function(){var e=this.host,t=e.shadowRoot,n=[],r=d(e);r.forEach (function(e){if(E(e)){var t=c(e);t&&t.length||(t=d(e)),n.push.apply(n,t)}else n. push(e)});for(var i,o;t;){if(i=void 0,p(t,b,function(e){return i=e,!1}),o=i,n=f( t,n),o){var a=M(t);if(a){t=a,L(t,o);continue}break}break}},appendChild:function( e,t){o(e,t),this.associateNode(t)},remove:function(e){l(e),this.associateNode(e) },removeAllChildNodes:function(e){i(e)},associateNode:function(e){B.set(e,this)} },D.prototype.invalidateShadowRenderer=function(e){var t=B.get(this);if(!t)retur n!1;var n;return(e||this.shadowRoot||(n=this.parentNode)&&(n.shadowRoot||n insta nceof ShadowRoot))&&t.invalidate(),!0},O.prototype.getDistributedNodes=function( ){return w(),c(this)},P(D.prototype,{get insertionParent(){return F.get(this)||n ull}}),e.eventParentsTable=A,e.getRendererForHost=v,e.getShadowTrees=N,e.nextOld erShadowTreeTable=j,e.renderAllPending=w,e.visual={removeAllChildNodes:i,appendC hild:o,removeChild:a}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){l.call(this,e)}function n(e){var n=document[e];t.prototype[e]=function(){r eturn w(n.apply(this.impl,arguments))}}function r(e){this.impl=e}function i(e,t) {var n=document.implementation[t];e.prototype[t]=function(){return w(n.apply(thi s.impl,arguments))}}function o(e,t){var n=document.implementation[t];e.prototype [t]=function(){return n.apply(this.impl,arguments)}}var a=e.GetElementsByInterfa ce,l=e.wrappers.Node,s=e.ParentNodeInterface,u=e.SelectorsInterface,c=e.defineWr apGetter,d=e.elementFromPoint,p=e.forwardMethodsToWrapper,f=e.mixin,h=e.register Wrapper,m=e.unwrap,w=e.wrap,g=e.wrapEventTargetMethods;e.wrapNodeList;var v=new SideTable;t.prototype=Object.create(l.prototype),c(t,"documentElement"),c(t,"bod y"),c(t,"head"),["getElementById","createElement","createElementNS","createTextN ode","createDocumentFragment","createEvent","createEventNS"].forEach(n);var E=do cument.adoptNode,y=document.write;f(t.prototype,{adoptNode:function(e){return E. call(this.impl,m(e)),e},elementFromPoint:function(e,t){return d(this,this,e,t)}, write:function(e){for(var t=this.querySelectorAll("*"),n=t[t.length-1];n.nextSib ling;)n=n.nextSibling;var r=n.parentNode;r.lastChild_=void 0,n.nextSibling_=void 0,y.call(this.impl,e)}}),p([window.HTMLBodyElement,window.HTMLDocument||window. Document,window.HTMLHeadElement],["appendChild","compareDocumentPosition","getEl ementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore ","querySelector","querySelectorAll","removeChild","replaceChild"]),p([window.HT MLDocument||window.Document],["adoptNode","createDocumentFragment","createElemen t","createElementNS","createEvent","createEventNS","createTextNode","elementFrom Point","getElementById","write"]),f(t.prototype,a),f(t.prototype,s),f(t.prototyp e,u),f(t.prototype,{get implementation(){var e=v.get(this);return e?e:(e=new r(m (this).implementation),v.set(this,e),e)}}),h(window.Document,t,document.implemen tation.createHTMLDocument("")),window.HTMLDocument&&h(window.HTMLDocument,t),g([ window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadEleme nt]),i(r,"createDocumentType"),i(r,"createDocument"),i(r,"createHTMLDocument"),o (r,"hasFeature"),h(window.DOMImplementation,r),p([window.DOMImplementation],["cr eateDocumentType","createDocument","createHTMLDocument","hasFeature"]),e.wrapper s.Document=t,e.wrappers.DOMImplementation=r}(this.ShadowDOMPolyfill),function(e) {"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.mixi n,i=e.registerWrapper,o=e.unwrap,a=e.unwrapIfNeeded,l=e.wrap,s=window.Window;t.p rototype=Object.create(n.prototype);var u=window.getComputedStyle;s.prototype.ge tComputedStyle=function(e,t){return u.call(this||window,a(e),t)},["addEventListe ner","removeEventListener","dispatchEvent"].forEach(function(e){s.prototype[e]=f unction(){var t=l(this||window);return t[e].apply(t,arguments)}}),r(t.prototype, {getComputedStyle:function(e,t){return u.call(o(this),a(e),t)}}),i(s,t),e.wrappe rs.Window=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){this .impl=e}function n(e){return new t(e)}function r(e){return e.map(n)}function i(e ){var t=this;this.impl=new c(function(n){e.call(t,r(n),t)})}var o=e.defineGetter ,a=e.defineWrapGetter,l=e.registerWrapper,s=e.unwrapIfNeeded,u=e.wrapNodeList;e. wrappers;var c=window.MutationObserver||window.WebKitMutationObserver;if(c){var d=window.MutationRecord;t.prototype={get addedNodes(){return u(this.impl.addedNo des)},get removedNodes(){return u(this.impl.removedNodes)}},["target","previousS ibling","nextSibling"].forEach(function(e){a(t,e)}),["type","attributeName","att ributeNamespace","oldValue"].forEach(function(e){o(t,e,function(){return this.im pl[e]})}),d&&l(d,t),window.Node,i.prototype={observe:function(e,t){this.impl.obs erve(s(e),t)
2 },disconnect:function(){this.impl.disconnect()},takeRecords:function(){return r( this.impl.takeRecords())}},e.wrappers.MutationObserver=i,e.wrappers.MutationReco rd=t}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=n[e] ,r=window[t];if(r){var i=document.createElement(e),o=i.constructor;window[t]=o}} e.isWrapperFor;var n={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTM LAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement" ,body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl :"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",di v:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font: "HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTML FrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElemen t",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li :"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLL inkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemEl ement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:" HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",opti on:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param :"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQ uoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLS ourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTable CaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTable RowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",text area:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video: "HTMLVideoElement"};Object.keys(n).forEach(t),Object.getOwnPropertyNames(e.wrapp ers).forEach(function(t){window[t]=e.wrappers[t]}),e.knownElements=n}(this.Shado wDOMPolyfill),function(){var e=window.ShadowDOMPolyfill;e.wrap,Object.defineProp erties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shado wRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.cre ateShadowRoot,window.dartMainRunner=function(t){function n(e){var t;if(e instanc eof i)t="NodeList";else if(e instanceof o)t="ShadowRoot";else if(e instanceof Mu tationRecord)t="MutationRecord";else if(e instanceof MutationObserver)t="Mutatio nObserver";else{if(a(e)){e=l(e);var n=e.constructor;if(n&&!n.builtin$cls&&"Gener atedWrapper"==n.name){var r=Object.prototype.toString.call(e);r=r.substring(8,r. length-1),n.builtin$cls=r}}t=s.call$1(e)}return t}function r(e){var t,n;return n ull==e?"Null":(t=e.constructor,"function"==typeof t&&(n=t.builtin$cls,null!=n)?n :void 0)}var i=e.wrappers.NodeList,o=e.wrappers.ShadowRoot,a=e.isWrapper,l=e.unw rap,s=window.$.getFunctionForTypeNameOf();window.$.constructorNameFallback=r,win dow.$._getTypeNameOf={call$1:n},window.Isolate.$isolateProperties._getTypeNameOf =window.$._getTypeNameOf,t()}}()}
OLDNEW
« no previous file with comments | « lib/shadowdom.debug.js ('k') | lib/src/analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698