@webcomponents/shadydom
Advanced tools
Comparing version 1.7.0 to 1.7.1
{ | ||
"name": "@webcomponents/shadydom", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "Shadow DOM polyfill", | ||
@@ -37,4 +37,4 @@ "main": "shadydom.min.js", | ||
"devDependencies": { | ||
"@webcomponents/custom-elements": "^1.3.1", | ||
"@webcomponents/shadycss": "^1.9.3", | ||
"@webcomponents/custom-elements": "^1.3.2", | ||
"@webcomponents/shadycss": "^1.9.4", | ||
"@webcomponents/template": "^1.4.1", | ||
@@ -47,3 +47,4 @@ "@webcomponents/webcomponents-platform": "^1.0.0", | ||
"access": "public" | ||
} | ||
}, | ||
"gitHead": "7ba7068ea59bcb4b20021f5db217fd437bd81190" | ||
} |
@@ -18,3 +18,3 @@ (function(){/* | ||
a},get innerHTML(){return this.__shady_innerHTML},set innerHTML(a){return this.__shady_innerHTML=a}}),Aa=A({get parentElement(){return this.__shady_parentElement},get parentNode(){return this.__shady_parentNode},get nextSibling(){return this.__shady_nextSibling},get previousSibling(){return this.__shady_previousSibling},get nextElementSibling(){return this.__shady_nextElementSibling},get previousElementSibling(){return this.__shady_previousElementSibling},get className(){return this.__shady_className}, | ||
set className(a){return this.__shady_className=a}});function Ba(a){for(var b in a){var c=a[b];c&&(c.enumerable=!1)}}Ba(ya);Ba(za);Ba(Aa);var Ca=u.c||!0===u.g,Da=Ca?function(){}:function(a){var b=r(a);b.N||(b.N=!0,va(a,Aa))},Fa=Ca?function(){}:function(a){var b=r(a);b.M||(b.M=!0,va(a,ya),window.customElements&&!u.g||va(a,za))};var E="__eventWrappers"+Date.now(),Ga=function(){var a=Object.getOwnPropertyDescriptor(Event.prototype,"composed");return a?function(b){return a.get.call(b)}:null}(),Ha=function(){function a(){}var b=!1,c={get capture(){b=!0;return!1}};window.addEventListener("test",a,c);window.removeEventListener("test",a,c);return b}();function Ia(a){if(a&&"object"===typeof a){var b=!!a.capture;var c=!!a.once;var d=!!a.passive;var e=a.i}else b=!!a,d=c=!1;return{K:e,capture:b,once:c,passive:d,J:Ha?a:b}} | ||
set className(a){return this.__shady_className=a}});function Ba(a){for(var b in a){var c=a[b];c&&(c.enumerable=!1)}}Ba(ya);Ba(za);Ba(Aa);var Ca=u.c||!0===u.g,Da=Ca?function(){}:function(a){var b=r(a);b.N||(b.N=!0,va(a,Aa))},Fa=Ca?function(){}:function(a){var b=r(a);b.M||(b.M=!0,va(a,ya),window.customElements&&window.customElements.polyfillWrapFlushCallback&&!u.g||va(a,za))};var E="__eventWrappers"+Date.now(),Ga=function(){var a=Object.getOwnPropertyDescriptor(Event.prototype,"composed");return a?function(b){return a.get.call(b)}:null}(),Ha=function(){function a(){}var b=!1,c={get capture(){b=!0;return!1}};window.addEventListener("test",a,c);window.removeEventListener("test",a,c);return b}();function Ia(a){if(a&&"object"===typeof a){var b=!!a.capture;var c=!!a.once;var d=!!a.passive;var e=a.i}else b=!!a,d=c=!1;return{K:e,capture:b,once:c,passive:d,J:Ha?a:b}} | ||
var Ja={blur:!0,focus:!0,focusin:!0,focusout:!0,click:!0,dblclick:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,wheel:!0,beforeinput:!0,input:!0,keydown:!0,keyup:!0,compositionstart:!0,compositionupdate:!0,compositionend:!0,touchstart:!0,touchend:!0,touchmove:!0,touchcancel:!0,pointerover:!0,pointerenter:!0,pointerdown:!0,pointermove:!0,pointerup:!0,pointercancel:!0,pointerout:!0,pointerleave:!0,gotpointercapture:!0,lostpointercapture:!0,dragstart:!0, | ||
@@ -74,5 +74,5 @@ drag:!0,dragenter:!0,dragleave:!0,dragover:!0,drop:!0,dragend:!0,DOMActivate:!0,DOMFocusIn:!0,DOMFocusOut:!0,keypress:!0},Ka={DOMAttrModified:!0,DOMAttributeNameChanged:!0,DOMCharacterDataModified:!0,DOMElementNameChanged:!0,DOMNodeInserted:!0,DOMNodeInsertedIntoDocument:!0,DOMNodeRemoved:!0,DOMNodeRemovedFromDocument:!0,DOMSubtreeModified:!0};function La(a){return a instanceof Node?a.__shady_getRootNode():a} | ||
configurable:!0})})})(Q.prototype); | ||
if(window.customElements&&u.D&&!u.preferPerformance){var mc=new Map;hc=function(){var a=[];mc.forEach(function(d,e){a.push([e,d])});mc.clear();for(var b=0;b<a.length;b++){var c=a[b][0];a[b][1]?c.__shadydom_connectedCallback():c.__shadydom_disconnectedCallback()}};U&&document.addEventListener("readystatechange",function(){U=!1;hc()},{once:!0});var nc=function(a,b,c){var d=0,e="__isConnected"+d++;if(b||c)a.prototype.connectedCallback=a.prototype.__shadydom_connectedCallback=function(){U?mc.set(this, | ||
!0):this[e]||(this[e]=!0,b&&b.call(this))},a.prototype.disconnectedCallback=a.prototype.__shadydom_disconnectedCallback=function(){U?this.isConnected||mc.set(this,!1):this[e]&&(this[e]=!1,c&&c.call(this))};return a},oc=window.customElements.define,pc=function(a,b){var c=b.prototype.connectedCallback,d=b.prototype.disconnectedCallback;oc.call(window.customElements,a,nc(b,c,d));b.prototype.connectedCallback=c;b.prototype.disconnectedCallback=d};window.customElements.define=pc;Object.defineProperty(window.CustomElementRegistry.prototype, | ||
"define",{value:pc,configurable:!0})}function G(a){a=a.__shady_getRootNode();if(w(a))return a};function qc(){this.a=!1;this.addedNodes=[];this.removedNodes=[];this.v=new Set}function nb(a){a.a||(a.a=!0,pa(function(){a.flush()}))}qc.prototype.flush=function(){if(this.a){this.a=!1;var a=this.takeRecords();a.length&&this.v.forEach(function(b){b(a)})}};qc.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]}; | ||
if(window.customElements&&window.customElements.define&&u.D&&!u.preferPerformance){var mc=new Map;hc=function(){var a=[];mc.forEach(function(d,e){a.push([e,d])});mc.clear();for(var b=0;b<a.length;b++){var c=a[b][0];a[b][1]?c.__shadydom_connectedCallback():c.__shadydom_disconnectedCallback()}};U&&document.addEventListener("readystatechange",function(){U=!1;hc()},{once:!0});var nc=function(a,b,c){var d=0,e="__isConnected"+d++;if(b||c)a.prototype.connectedCallback=a.prototype.__shadydom_connectedCallback= | ||
function(){U?mc.set(this,!0):this[e]||(this[e]=!0,b&&b.call(this))},a.prototype.disconnectedCallback=a.prototype.__shadydom_disconnectedCallback=function(){U?this.isConnected||mc.set(this,!1):this[e]&&(this[e]=!1,c&&c.call(this))};return a},oc=window.customElements.define,pc=function(a,b){var c=b.prototype.connectedCallback,d=b.prototype.disconnectedCallback;oc.call(window.customElements,a,nc(b,c,d));b.prototype.connectedCallback=c;b.prototype.disconnectedCallback=d};window.customElements.define= | ||
pc;Object.defineProperty(window.CustomElementRegistry.prototype,"define",{value:pc,configurable:!0})}function G(a){a=a.__shady_getRootNode();if(w(a))return a};function qc(){this.a=!1;this.addedNodes=[];this.removedNodes=[];this.v=new Set}function nb(a){a.a||(a.a=!0,pa(function(){a.flush()}))}qc.prototype.flush=function(){if(this.a){this.a=!1;var a=this.takeRecords();a.length&&this.v.forEach(function(b){b(a)})}};qc.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]}; | ||
function rc(a,b){var c=r(a);c.m||(c.m=new qc);c.m.v.add(b);var d=c.m;return{P:b,S:d,R:a,takeRecords:function(){return d.takeRecords()}}}function sc(a){var b=a&&a.S;b&&(b.v.delete(a.P),b.v.size||(r(a.R).m=null))} | ||
@@ -79,0 +79,0 @@ function tc(a,b){var c=b.getRootNode();return a.map(function(d){var e=c===d.target.getRootNode();if(e&&d.addedNodes){if(e=Array.from(d.addedNodes).filter(function(f){return c===f.getRootNode()}),e.length)return d=Object.create(d),Object.defineProperty(d,"addedNodes",{value:e,configurable:!0}),d}else if(e)return d}).filter(function(d){return d})};var uc=u.c,vc={querySelector:function(a){return this.__shady_native_querySelector(a)},querySelectorAll:function(a){return this.__shady_native_querySelectorAll(a)}},wc={};function xc(a){wc[a]=function(b){return b["__shady_native_"+a]}}function V(a,b){z(a,b,"__shady_native_");for(var c in b)xc(c)}function W(a,b){b=void 0===b?[]:b;for(var c=0;c<b.length;c++){var d=b[c],e=Object.getOwnPropertyDescriptor(a,d);e&&(Object.defineProperty(a,"__shady_native_"+d,e),e.value?vc[d]||(vc[d]=e.value):xc(d))}} |
@@ -589,4 +589,6 @@ /** | ||
// Mitigate connect/disconnect spam by wrapping custom element classes. | ||
if (window['customElements'] && utils.settings.inUse && !utils.settings['preferPerformance']) { | ||
// Mitigate connect/disconnect spam by wrapping custom element classes. This | ||
// should happen if custom elements are available in any capacity, polyfilled or | ||
// not. | ||
if (utils.hasCustomElements() && utils.settings.inUse && !utils.settings['preferPerformance']) { | ||
@@ -593,0 +595,0 @@ // process connect/disconnect after roots have rendered to avoid |
@@ -170,8 +170,8 @@ /** | ||
// Therefore continue to patch in this case. | ||
// If customElements is not loaded, then these accessors should be | ||
// patched so they work correctly. | ||
if (!window['customElements'] || utils.settings.noPatch) { | ||
// If the custom elements polyfill is not loaded, then these accessors | ||
// should be patched so they work correctly. | ||
if (!utils.hasPolyfilledCustomElements() || utils.settings.noPatch) { | ||
utils.patchExistingProperties(element, TextContentInnerHTMLDescriptors); | ||
} | ||
} | ||
} | ||
} |
@@ -17,2 +17,12 @@ /** | ||
// The user might need to pass the custom elements polyfill a flag by setting an | ||
// object to `customElements`, so check for `customElements.define` also. | ||
export const hasCustomElements = | ||
() => Boolean(window.customElements && window.customElements.define); | ||
// The custom elements polyfill is typically loaded after Shady DOM, so this | ||
// check isn't reliable during initial evaluation. However, because the | ||
// polyfills are loaded immediately after one another, it works at runtime. | ||
export const hasPolyfilledCustomElements = | ||
() => Boolean(window.customElements && window.customElements['polyfillWrapFlushCallback']); | ||
const desc = Object.getOwnPropertyDescriptor(Node.prototype, 'firstChild'); | ||
@@ -19,0 +29,0 @@ |
Sorry, the diff of this file is not supported yet
473813
4723