Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webcomponents/shadydom

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webcomponents/shadydom - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

2

package.json
{
"name": "@webcomponents/shadydom",
"version": "1.4.0",
"version": "1.4.1",
"description": "Shadow DOM polyfill",

@@ -5,0 +5,0 @@ "main": "shadydom.min.js",

@@ -15,8 +15,8 @@ (function(){/*

b[l-1][n-1];else{var q=b[l-1][n]+1,P=b[l][n-1]+1;b[l][n]=q<P?q:P}k=b.length-1;h=b[0].length-1;d=b[k][h];for(a=[];0<k||0<h;)0==k?(a.push(2),h--):0==h?(a.push(3),k--):(g=b[k-1][h-1],l=b[k-1][h],n=b[k][h-1],q=l<n?l<g?l:g:n<g?n:g,q==g?(g==d?a.push(0):(a.push(1),d=g),k--,h--):q==l?(a.push(3),k--,d=l):(a.push(2),h--,d=n));a.reverse();b=void 0;k=[];for(h=0;h<a.length;h++)switch(a[h]){case 0:b&&(k.push(b),b=void 0);e++;f++;break;case 1:b||(b=r(e,0));b.A++;e++;b.s.push(c[f]);f++;break;case 2:b||(b=r(e,0));
b.A++;e++;break;case 3:b||(b=r(e,0)),b.s.push(c[f]),f++}b&&k.push(b);return k}function ka(a,b){return a===b};function la(){this.O=this.root=null;this.C=!1;this.h=this.w=this.I=this.assignedSlot=this.assignedNodes=this.j=null;this.childNodes=this.nextSibling=this.previousSibling=this.lastChild=this.firstChild=this.parentNode=this.o=void 0;this.K=this.L=!1;this.v={}}la.prototype.toJSON=function(){return{}};function t(a){a.__shady||(a.__shady=new la);return a.__shady}function u(a){return a&&a.__shady};var v=window.ShadyDOM||{};v.Y=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var ma=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");v.f=!!(ma&&ma.configurable&&ma.get);v.J=v.force||!v.Y;v.m=v.noPatch||!1;v.N=v.preferPerformance;function w(a){return(a=u(a))&&void 0!==a.firstChild}function x(a){return"ShadyRoot"===a.V}function y(a){a=a.__shady_getRootNode();if(x(a))return a}function na(a){return(a=(a=u(a))&&a.root)&&oa(a)}
b.A++;e++;break;case 3:b||(b=r(e,0)),b.s.push(c[f]),f++}b&&k.push(b);return k}function ka(a,b){return a===b};function la(){this.O=this.root=null;this.C=!1;this.h=this.w=this.I=this.assignedSlot=this.assignedNodes=this.j=null;this.childNodes=this.nextSibling=this.previousSibling=this.lastChild=this.firstChild=this.parentNode=this.o=void 0;this.K=this.L=!1;this.v={}}la.prototype.toJSON=function(){return{}};function t(a){a.__shady||(a.__shady=new la);return a.__shady}function u(a){return a&&a.__shady};var v=window.ShadyDOM||{};v.Y=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var ma=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");v.c=!!(ma&&ma.configurable&&ma.get);v.J=v.force||!v.Y;v.m=v.noPatch||!1;v.N=v.preferPerformance;function w(a){return(a=u(a))&&void 0!==a.firstChild}function x(a){return"ShadyRoot"===a.V}function y(a){a=a.__shady_getRootNode();if(x(a))return a}function na(a){return(a=(a=u(a))&&a.root)&&oa(a)}
var z=Element.prototype,pa=z.matches||z.matchesSelector||z.mozMatchesSelector||z.msMatchesSelector||z.oMatchesSelector||z.webkitMatchesSelector,qa=document.createTextNode(""),ra=0,sa=[];(new MutationObserver(function(){for(;sa.length;)try{sa.shift()()}catch(a){throw qa.textContent=ra++,a;}})).observe(qa,{characterData:!0});function ta(a){sa.push(a);qa.textContent=ra++}var ua=!!document.contains;function va(a,b){for(;b;){if(b==a)return!0;b=b.__shady_parentNode}return!1}
function wa(a){for(var b=a.length-1;0<=b;b--){var c=a[b],d=c.getAttribute("id")||c.getAttribute("name");d&&"length"!==d&&isNaN(d)&&(a[d]=c)}a.item=function(b){return a[b]};a.namedItem=function(b){if("length"!==b&&isNaN(b)&&a[b])return a[b];for(var c=ha(a),d=c.next();!d.done;d=c.next())if(d=d.value,(d.getAttribute("id")||d.getAttribute("name"))==b)return d;return null};return a}
function A(a,b,c){c=void 0===c?"":c;for(var d in b){var e=b[d];e.configurable=!0;var f=c+d;if(e.value)a[f]=e.value;else try{Object.defineProperty(a,f,e)}catch(h){}}}function B(a){var b={};Object.getOwnPropertyNames(a).forEach(function(c){b[c]=Object.getOwnPropertyDescriptor(a,c)});return b};var C=[],xa;function ya(a){xa||(xa=!0,ta(D));C.push(a)}function D(){xa=!1;for(var a=!!C.length;C.length;)C.shift()();return a}D.list=C;var E=B({get childNodes(){return this.__shady_childNodes},get firstChild(){return this.__shady_firstChild},get lastChild(){return this.__shady_lastChild},get textContent(){return this.__shady_textContent},set textContent(a){this.__shady_textContent=a},get childElementCount(){return this.__shady_childElementCount},get children(){return this.__shady_children},get firstElementChild(){return this.__shady_firstElementChild},get lastElementChild(){return this.__shady_lastElementChild},get innerHTML(){return this.__shady_innerHTML},
function A(a,b,c,d){c=void 0===c?"":c;for(var e in b){var f=b[e];if(!(d&&0<=d.indexOf(e))){f.configurable=!0;var h=c+e;if(f.value)a[h]=f.value;else try{Object.defineProperty(a,h,f)}catch(g){}}}}function B(a){var b={};Object.getOwnPropertyNames(a).forEach(function(c){b[c]=Object.getOwnPropertyDescriptor(a,c)});return b};var C=[],xa;function ya(a){xa||(xa=!0,ta(D));C.push(a)}function D(){xa=!1;for(var a=!!C.length;C.length;)C.shift()();return a}D.list=C;var E=B({get childNodes(){return this.__shady_childNodes},get firstChild(){return this.__shady_firstChild},get lastChild(){return this.__shady_lastChild},get textContent(){return this.__shady_textContent},set textContent(a){this.__shady_textContent=a},get childElementCount(){return this.__shady_childElementCount},get children(){return this.__shady_children},get firstElementChild(){return this.__shady_firstElementChild},get lastElementChild(){return this.__shady_lastElementChild},get innerHTML(){return this.__shady_innerHTML},
set innerHTML(a){return this.__shady_innerHTML=a},get shadowRoot(){return this.__shady_shadowRoot}}),F=B({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}}),za;for(za in E)E[za].enumerable=!1;for(var Aa in F)F[Aa].enumerable=!1;var Ba=v.f||v.m,Ca=Ba?function(){}:function(a){var b=t(a);b.L||(b.L=!0,A(a,F))},Da=Ba?function(){}:function(a){var b=t(a);b.K||(b.K=!0,A(a,E))};function Ea(a,b,c){Ca(a);c=c||null;var d=t(a),e=t(b),f=c?t(c):null;d.previousSibling=c?f.previousSibling:b.__shady_lastChild;if(f=u(d.previousSibling))f.nextSibling=a;if(f=u(d.nextSibling=c))f.previousSibling=a;d.parentNode=b;c?c===e.firstChild&&(e.firstChild=a):(e.lastChild=a,e.firstChild||(e.firstChild=a));e.childNodes=null}
set className(a){return this.__shady_className=a}}),za;for(za in E)E[za].enumerable=!1;for(var Aa in F)F[Aa].enumerable=!1;var Ba=v.c||v.m,Ca=Ba?function(){}:function(a){var b=t(a);b.L||(b.L=!0,A(a,F))},Da=Ba?function(){}:function(a){var b=t(a);b.K||(b.K=!0,A(a,E))};function Ea(a,b,c){Ca(a);c=c||null;var d=t(a),e=t(b),f=c?t(c):null;d.previousSibling=c?f.previousSibling:b.__shady_lastChild;if(f=u(d.previousSibling))f.nextSibling=a;if(f=u(d.nextSibling=c))f.previousSibling=a;d.parentNode=b;c?c===e.firstChild&&(e.firstChild=a):(e.lastChild=a,e.firstChild||(e.firstChild=a));e.childNodes=null}
function Fa(a,b,c){Da(b);var d=t(b);void 0!==d.firstChild&&(d.childNodes=null);if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){d=a.__shady_childNodes;for(var e=0;e<d.length;e++)Ea(d[e],b,c);a=t(a);b=void 0!==a.firstChild?null:void 0;a.firstChild=a.lastChild=b;a.childNodes=b}else Ea(a,b,c)}

@@ -29,5 +29,5 @@ function Ga(a,b){var c=t(a);b=t(b);a===b.firstChild&&(b.firstChild=c.nextSibling);a===b.lastChild&&(b.lastChild=c.previousSibling);a=c.previousSibling;var d=c.nextSibling;a&&(t(a).nextSibling=d);d&&(t(d).previousSibling=a);c.parentNode=c.previousSibling=c.nextSibling=void 0;void 0!==b.childNodes&&(b.childNodes=null)}

var a=this.ownerDocument;if(ua){if(a.__shady_native_contains(this))return!0}else if(a.documentElement&&a.documentElement.__shady_native_contains(this))return!0;for(a=this;a&&!(a instanceof Document);)a=a.__shady_parentNode||(x(a)?a.host:void 0);return!!(a&&a instanceof Document)},get textContent(){if(w(this)){for(var a=[],b=0,c=this.__shady_childNodes,d;d=c[b];b++)d.nodeType!==Node.COMMENT_NODE&&a.push(d.__shady_textContent);return a.join("")}return this.__shady_native_textContent},set textContent(a){if("undefined"===
typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:if(!w(this)&&v.f){var b=this.__shady_firstChild;(b!=this.__shady_lastChild||b&&b.nodeType!=Node.TEXT_NODE)&&Ma(this);this.__shady_native_textContent=a}else Ma(this),(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_insertBefore(document.createTextNode(a));break;default:this.nodeValue=a}},insertBefore:function(a,b){if(this.ownerDocument!==Ia&&a.ownerDocument!==Ia)return this.__shady_native_insertBefore(a,
typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:if(!w(this)&&v.c){var b=this.__shady_firstChild;(b!=this.__shady_lastChild||b&&b.nodeType!=Node.TEXT_NODE)&&Ma(this);this.__shady_native_textContent=a}else Ma(this),(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_insertBefore(document.createTextNode(a));break;default:this.nodeValue=a}},insertBefore:function(a,b){if(this.ownerDocument!==Ia&&a.ownerDocument!==Ia)return this.__shady_native_insertBefore(a,
b),a;if(a===this)throw Error("Failed to execute 'appendChild' on 'Node': The new child element contains the parent.");if(b){var c=u(b);c=c&&c.parentNode;if(void 0!==c&&c!==this||void 0===c&&b.__shady_native_parentNode!==this)throw Error("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.");}if(b===a)return a;var d=[],e=(c=y(this))?c.host.localName:G(this),f=a.__shady_parentNode;if(f){var h=G(a);f.__shady_removeChild(a,!!c||
!y(a))}f=!0;var g=(!Ja||void 0===a.__noInsertionPoint)&&!Ra(a,e),k=c&&!a.__noInsertionPoint&&(!Ja||a.nodeType===Node.DOCUMENT_FRAGMENT_NODE);if(k||g)g&&(h=h||G(a)),Sa(a,function(a){k&&"slot"===a.localName&&d.push(a);if(g){var b=h;H()&&(b&&Ta(a,b),(b=H())&&b.scopeNode(a,e))}});if("slot"===this.localName||d.length)d.length&&(c.c=c.c||[],c.a=c.a||[],c.b=c.b||{},c.c.push.apply(c.c,d instanceof Array?d:ia(ha(d)))),c&&I(c);w(this)&&(Fa(a,this,b),c=u(this),na(this)?(I(c.root),f=!1):c.root&&(f=!1));f?(c=
!y(a))}f=!0;var g=(!Ja||void 0===a.__noInsertionPoint)&&!Ra(a,e),k=c&&!a.__noInsertionPoint&&(!Ja||a.nodeType===Node.DOCUMENT_FRAGMENT_NODE);if(k||g)g&&(h=h||G(a)),Sa(a,function(a){k&&"slot"===a.localName&&d.push(a);if(g){var b=h;H()&&(b&&Ta(a,b),(b=H())&&b.scopeNode(a,e))}});if("slot"===this.localName||d.length)d.length&&(c.f=c.f||[],c.a=c.a||[],c.b=c.b||{},c.f.push.apply(c.f,d instanceof Array?d:ia(ha(d)))),c&&I(c);w(this)&&(Fa(a,this,b),c=u(this),na(this)?(I(c.root),f=!1):c.root&&(f=!1));f?(c=
x(this)?this.host:this,b?(b=Oa(b),c.__shady_native_insertBefore(a,b)):c.__shady_native_appendChild(a)):a.ownerDocument!==this.ownerDocument&&this.ownerDocument.adoptNode(a);Pa(this,a);return a},appendChild:function(a){return this.__shady_insertBefore(a)},removeChild:function(a,b){b=void 0===b?!1:b;if(this.ownerDocument!==Ia)return this.__shady_native_removeChild(a);if(a.__shady_parentNode!==this)throw Error("The node to be removed is not a child of this node: "+a);var c=y(a),d=u(this);if(w(this)&&

@@ -38,7 +38,7 @@ (Ga(a,this),na(this))){I(d.root);var e=!0}if(H()&&!b&&c){var f=G(a);Sa(a,function(a){Ta(a,f)})}Na(a);if(c){var h=this&&"slot"===this.localName;h&&(e=!0);((b=Ua(c,a))||h)&&I(c)}e||(e=x(this)?this.host:this,(!d.root&&"slot"!==a.localName||e===a.__shady_native_parentNode)&&e.__shady_native_removeChild(a));Pa(this,null,a);return a},replaceChild:function(a,b){this.__shady_insertBefore(a,b);this.__shady_removeChild(b);return a},cloneNode:function(a){if("template"==this.localName)return this.__shady_native_cloneNode(a);

function(a){return a.nodeType===Node.ELEMENT_NODE})):this.__shady_native_children},get childElementCount(){return this.__shady_children.length}}),Xa=B({querySelector:function(a){return Va(this,function(b){return pa.call(b,a)},function(a){return!!a})[0]||null},querySelectorAll:function(a,b){if(b){b=Array.prototype.slice.call(this.__shady_native_querySelectorAll(a));var c=this.__shady_getRootNode();return b.filter(function(a){return a.__shady_getRootNode()==c})}return Va(this,function(b){return pa.call(b,
a)})}}),Ya=v.N?Object.assign({},K):K;Object.assign(K,Xa);var Za=B({getElementById:function(a){return""===a?null:Va(this,function(b){return b.id==a},function(a){return!!a})[0]||null}});var $a=B({get activeElement(){var a=v.f?document.__shady_native_activeElement:document.activeElement;if(!a||!a.nodeType)return null;var b=!!x(this);if(!(this===document||b&&this.host!==a&&this.host.__shady_native_contains(a)))return null;for(b=y(a);b&&b!==this;)a=b.host,b=y(a);return this===document?b?null:a:b===this?a:null}});var ab=/[&\u00A0"]/g,cb=/[&\u00A0<>]/g;function db(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";case "\u00a0":return"&nbsp;"}}function eb(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}var fb=eb("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),gb=eb("style script xmp iframe noembed noframes plaintext noscript".split(" "));
a)})}}),Ya=v.N?Object.assign({},K):K;Object.assign(K,Xa);var Za=B({getElementById:function(a){return""===a?null:Va(this,function(b){return b.id==a},function(a){return!!a})[0]||null}});var $a=B({get activeElement(){var a=v.c?document.__shady_native_activeElement:document.activeElement;if(!a||!a.nodeType)return null;var b=!!x(this);if(!(this===document||b&&this.host!==a&&this.host.__shady_native_contains(a)))return null;for(b=y(a);b&&b!==this;)a=b.host,b=y(a);return this===document?b?null:a:b===this?a:null}});var ab=/[&\u00A0"]/g,cb=/[&\u00A0<>]/g;function db(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";case "\u00a0":return"&nbsp;"}}function eb(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}var fb=eb("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),gb=eb("style script xmp iframe noembed noframes plaintext noscript".split(" "));
function hb(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):a.childNodes,e=0,f=d.length,h;e<f&&(h=d[e]);e++){a:{var g=h;var k=a;var l=b;switch(g.nodeType){case Node.ELEMENT_NODE:for(var n=g.localName,q="<"+n,P=g.attributes,bb=0;k=P[bb];bb++)q+=" "+k.name+'="'+k.value.replace(ab,db)+'"';q+=">";g=fb[n]?q:q+hb(g,l)+"</"+n+">";break a;case Node.TEXT_NODE:g=g.data;g=k&&gb[k.localName]?g:g.replace(cb,db);break a;case Node.COMMENT_NODE:g="\x3c!--"+g.data+"--\x3e";break a;default:throw window.console.error(g),
Error("not implemented");}}c+=g}return c};var ib=document.implementation.createHTMLDocument("inert"),jb=B({get innerHTML(){return w(this)?hb("template"===this.localName?this.content:this,function(a){return a.__shady_childNodes}):this.__shady_native_innerHTML},set innerHTML(a){if("template"===this.localName)this.__shady_native_innerHTML=a;else{Ma(this);var b=this.localName||"div";b=this.namespaceURI&&this.namespaceURI!==ib.namespaceURI?ib.createElementNS(this.namespaceURI,b):ib.createElement(b);for(v.f?b.__shady_native_innerHTML=a:b.innerHTML=
a;a=b.__shady_firstChild;)this.__shady_insertBefore(a)}}});var kb=B({addEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.H=this;this.host.__shady_addEventListener(a,b,c)},removeEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.H=this;this.host.__shady_removeEventListener(a,b,c)}});function lb(a,b){A(a,kb,b);A(a,$a,b);A(a,jb,b);A(a,K,b);v.m&&!b?(A(a,J,b),A(a,Za,b)):v.f||(A(a,F),A(a,E))};var mb={},L=v.deferConnectionCallbacks&&"loading"===document.readyState,M;function nb(a){var b=[];do b.unshift(a);while(a=a.__shady_parentNode);return b}
function N(a,b,c){if(a!==mb)throw new TypeError("Illegal constructor");this.V="ShadyRoot";this.host=b;this.mode=c&&c.mode;Ha(b);a=t(b);a.root=this;a.O="closed"!==this.mode?this:null;a=t(this);a.firstChild=a.lastChild=a.parentNode=a.nextSibling=a.previousSibling=null;a.childNodes=[];this.g=this.i=!1;this.c=this.b=this.a=null;if(v.preferPerformance)for(;a=b.__shady_native_firstChild;)b.__shady_native_removeChild(a);else I(this)}
Error("not implemented");}}c+=g}return c};var ib=document.implementation.createHTMLDocument("inert"),jb=B({get innerHTML(){return w(this)?hb("template"===this.localName?this.content:this,function(a){return a.__shady_childNodes}):this.__shady_native_innerHTML},set innerHTML(a){if("template"===this.localName)this.__shady_native_innerHTML=a;else{Ma(this);var b=this.localName||"div";b=this.namespaceURI&&this.namespaceURI!==ib.namespaceURI?ib.createElementNS(this.namespaceURI,b):ib.createElement(b);for(v.c?b.__shady_native_innerHTML=a:b.innerHTML=
a;a=b.__shady_firstChild;)this.__shady_insertBefore(a)}}});var kb=B({addEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.H=this;this.host.__shady_addEventListener(a,b,c)},removeEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.H=this;this.host.__shady_removeEventListener(a,b,c)}});function lb(a,b){A(a,kb,b);A(a,$a,b);A(a,jb,b);A(a,K,b);v.m&&!b?(A(a,J,b),A(a,Za,b)):v.c||(A(a,F),A(a,E))};var mb={},L=v.deferConnectionCallbacks&&"loading"===document.readyState,M;function nb(a){var b=[];do b.unshift(a);while(a=a.__shady_parentNode);return b}
function N(a,b,c){if(a!==mb)throw new TypeError("Illegal constructor");this.V="ShadyRoot";this.host=b;this.mode=c&&c.mode;Ha(b);a=t(b);a.root=this;a.O="closed"!==this.mode?this:null;a=t(this);a.firstChild=a.lastChild=a.parentNode=a.nextSibling=a.previousSibling=null;a.childNodes=[];this.g=this.i=!1;this.f=this.b=this.a=null;if(v.preferPerformance)for(;a=b.__shady_native_firstChild;)b.__shady_native_removeChild(a);else I(this)}
function I(a){a.i||(a.i=!0,ya(function(){var b=ob(a);b&&b._renderRoot()}))}function ob(a){for(var b;a;){a.i&&(b=a);a:{var c=a;a=c.host.__shady_getRootNode();if(x(a))for(var d=c.host.__shady_childNodes,e=0;e<d.length;e++)if(c=d[e],"slot"==c.localName)break a;a=void 0}}return b}function pb(a){(a=ob(a))&&a.i&&a._renderRoot()}

@@ -49,3 +49,3 @@ N.prototype._renderRoot=function(){var a=L;L=!0;this.i=!1;if(this.a){O(this);for(var b=0,c;b<this.a.length;b++){c=this.a[b];var d=u(c),e=d.assignedNodes;d.assignedNodes=[];d.h=[];if(d.I=e)for(d=0;d<e.length;d++){var f=u(e[d]);f.w=f.assignedSlot;f.assignedSlot===c&&(f.assignedSlot=null)}}for(c=this.host.__shady_firstChild;c;c=c.__shady_nextSibling)qb(this,c);for(b=0;b<this.a.length;b++){c=this.a[b];e=u(c);if(!e.assignedNodes.length)for(d=c.__shady_firstChild;d;d=d.__shady_nextSibling)qb(this,d,c);

c=0,b=q.length;c<b;c++)e=q[c],d=u(e),e.__shady_native_parentNode!==this.host||"slot"!==e.localName&&d.assignedSlot||this.host.__shady_native_removeChild(e);this.g=!0;L=a;M&&M()};function qb(a,b,c){var d=t(b),e=d.w;d.w=null;c||(c=(a=a.b[b.__shady_slot||"__catchall"])&&a[0]);c?(t(c).assignedNodes.push(b),d.assignedSlot=c):d.assignedSlot=void 0;e!==d.assignedSlot&&d.assignedSlot&&(t(d.assignedSlot).C=!0)}
function rb(a,b,c){for(var d=0,e;d<c.length&&(e=c[d]);d++)if("slot"==e.localName){var f=u(e).assignedNodes;f&&f.length&&rb(a,b,f)}else b.push(c[d])}function sb(a,b){b.__shady_native_dispatchEvent(new Event("slotchange"));b=u(b);b.assignedSlot&&sb(a,b.assignedSlot)}function O(a){if(a.c&&a.c.length){for(var b=a.c,c,d=0;d<b.length;d++){var e=b[d];Ha(e);Ha(e.__shady_parentNode);var f=tb(e);a.b[f]?(c=c||{},c[f]=!0,a.b[f].push(e)):a.b[f]=[e];a.a.push(e)}if(c)for(var h in c)a.b[h]=ub(a.b[h]);a.c=[]}}
function rb(a,b,c){for(var d=0,e;d<c.length&&(e=c[d]);d++)if("slot"==e.localName){var f=u(e).assignedNodes;f&&f.length&&rb(a,b,f)}else b.push(c[d])}function sb(a,b){b.__shady_native_dispatchEvent(new Event("slotchange"));b=u(b);b.assignedSlot&&sb(a,b.assignedSlot)}function O(a){if(a.f&&a.f.length){for(var b=a.f,c,d=0;d<b.length;d++){var e=b[d];Ha(e);Ha(e.__shady_parentNode);var f=tb(e);a.b[f]?(c=c||{},c[f]=!0,a.b[f].push(e)):a.b[f]=[e];a.a.push(e)}if(c)for(var h in c)a.b[h]=ub(a.b[h]);a.f=[]}}
function tb(a){var b=a.name||a.getAttribute("name")||"__catchall";return a.T=b}function ub(a){return a.sort(function(a,c){a=nb(a);for(var b=nb(c),e=0;e<a.length;e++){c=a[e];var f=b[e];if(c!==f)return a=Array.from(c.__shady_parentNode.__shady_childNodes),a.indexOf(c)-a.indexOf(f)}})}

@@ -71,4 +71,4 @@ function Ua(a,b){if(a.a){O(a);var c=a.b,d;for(d in c)for(var e=c[d],f=0;f<e.length;f++){var h=e[f];if(va(b,h)){e.splice(f,1);var g=a.a.indexOf(h);0<=g&&a.a.splice(g,1);f--;h=u(h);if(g=h.h)for(var k=0;k<g.length;k++){var l=g[k],n=l.__shady_native_parentNode;n&&n.__shady_native_removeChild(l)}h.h=[];h.assignedNodes=[];g=!0}}return g}}function oa(a){O(a);return!(!a.a||!a.a.length)}

var Rb=B({get composed(){void 0===this.u&&(Bb?this.u="focusin"===this.type||"focusout"===this.type||Bb(this):!1!==this.isTrusted&&(this.u=Cb[this.type]));return this.u||!1},composedPath:function(){this.l||(this.l=S(this.__target,this.composed));return this.l},get target(){return Gb(this.currentTarget||this.__previousCurrentTarget,this.composedPath())},get relatedTarget(){if(!this.G)return null;this.M||(this.M=S(this.G,!0));return Gb(this.currentTarget||this.__previousCurrentTarget,this.M)},stopPropagation:function(){Event.prototype.stopPropagation.call(this);
this.F=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.F=this.P=!0}});function Ob(a){a.__target=a.target;a.G=a.relatedTarget;if(v.f){var b=Object.getPrototypeOf(a);if(!Object.hasOwnProperty(b,"__shady_patchedProto")){var c=Object.create(b);c.__shady_sourceProto=b;A(c,Rb);b.__shady_patchedProto=c}a.__proto__=b.__shady_patchedProto}else A(a,Rb)}var Sb=Hb(Event),Tb=Hb(CustomEvent),Ub=Hb(MouseEvent);
function Vb(){if(!Bb&&Object.getOwnPropertyDescriptor(Event.prototype,"isTrusted")){var a=function(){var a=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0});this.__shady_dispatchEvent(a)};Element.prototype.click?Element.prototype.click=a:HTMLElement.prototype.click&&(HTMLElement.prototype.click=a)}}var Wb=Object.getOwnPropertyNames(Document.prototype).filter(function(a){return"on"===a.substring(0,2)});var T=v.f,Xb={querySelector:function(a){return this.__shady_native_querySelector(a)},querySelectorAll:function(a){return this.__shady_native_querySelectorAll(a)}},Yb={};function Zb(a){Yb[a]=function(b){return b["__shady_native_"+a]}}function U(a,b){A(a,b,"__shady_native_");for(var c in b)Zb(c)}function V(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?Xb[d]||(Xb[d]=e.value):Zb(d))}}
this.F=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.F=this.P=!0}});function Ob(a){a.__target=a.target;a.G=a.relatedTarget;if(v.c){var b=Object.getPrototypeOf(a);if(!Object.hasOwnProperty(b,"__shady_patchedProto")){var c=Object.create(b);c.__shady_sourceProto=b;A(c,Rb);b.__shady_patchedProto=c}a.__proto__=b.__shady_patchedProto}else A(a,Rb)}var Sb=Hb(Event),Tb=Hb(CustomEvent),Ub=Hb(MouseEvent);
function Vb(){if(!Bb&&Object.getOwnPropertyDescriptor(Event.prototype,"isTrusted")){var a=function(){var a=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0});this.__shady_dispatchEvent(a)};Element.prototype.click?Element.prototype.click=a:HTMLElement.prototype.click&&(HTMLElement.prototype.click=a)}}var Wb=Object.getOwnPropertyNames(Document.prototype).filter(function(a){return"on"===a.substring(0,2)});var T=v.c,Xb={querySelector:function(a){return this.__shady_native_querySelector(a)},querySelectorAll:function(a){return this.__shady_native_querySelectorAll(a)}},Yb={};function Zb(a){Yb[a]=function(b){return b["__shady_native_"+a]}}function U(a,b){A(a,b,"__shady_native_");for(var c in b)Zb(c)}function V(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?Xb[d]||(Xb[d]=e.value):Zb(d))}}
var W=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),X=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),$b=document.implementation.createHTMLDocument("inert");function ac(a){for(var b;b=a.__shady_native_firstChild;)a.__shady_native_removeChild(b)}var bc=["firstElementChild","lastElementChild","children","childElementCount"],cc=["querySelector","querySelectorAll"];

@@ -86,3 +86,3 @@ function dc(){var a=["dispatchEvent","addEventListener","removeEventListener"];window.EventTarget?V(window.EventTarget.prototype,a):(V(Node.prototype,a),V(Window.prototype,a));T?V(Node.prototype,"parentNode firstChild lastChild previousSibling nextSibling childNodes parentElement textContent".split(" ")):U(Node.prototype,{parentNode:{get:function(){W.currentNode=this;return W.parentNode()}},firstChild:{get:function(){W.currentNode=this;return W.firstChild()}},lastChild:{get:function(){W.currentNode=

a)},attachShadow:function(a){if(!this)throw"Must provide a host.";if(!a)throw"Not enough arguments.";return new N(mb,this,a)}});var kc=B({blur:function(){var a=u(this);(a=(a=a&&a.root)&&a.activeElement)?a.__shady_blur():this.__shady_native_blur()}});Wb.forEach(function(a){kc[a]={set:function(b){var c=t(this),d=a.substring(2);c.v[a]&&this.removeEventListener(d,c.v[a]);this.__shady_addEventListener(d,b);c.v[a]=b},get:function(){var b=u(this);return b&&b.v[a]},configurable:!0}});var lc=B({assignedNodes:function(a){if("slot"===this.localName){var b=this.__shady_getRootNode();b&&x(b)&&pb(b);return(b=u(this))?(a&&a.flatten?b.h:b.assignedNodes)||[]:[]}}});var mc=window.document,nc=B({importNode:function(a,b){if(a.ownerDocument!==mc||"template"===a.localName)return this.__shady_native_importNode(a,b);var c=this.__shady_native_importNode(a,!1);if(b){a=a.__shady_childNodes;b=0;for(var d;b<a.length;b++)d=this.__shady_importNode(a[b],!0),c.__shady_appendChild(d)}return c}});var oc=B({addEventListener:Nb.bind(window),removeEventListener:Pb.bind(window)});var Y={};Object.getOwnPropertyDescriptor(HTMLElement.prototype,"parentElement")&&(Y.parentElement=J.parentElement);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"contains")&&(Y.contains=J.contains);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"children")&&(Y.children=K.children);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&(Y.innerHTML=jb.innerHTML);
var pc={EventTarget:[ec],Node:[J,window.EventTarget?null:ec],Text:[fc],Element:[jc,K,fc,!v.f||"innerHTML"in Element.prototype?jb:null,window.HTMLSlotElement?null:lc],HTMLElement:[kc,Y],HTMLSlotElement:[lc],DocumentFragment:[Ya,Za],Document:[nc,Ya,Za,$a],Window:[oc]};function qc(a){var b={},c;for(c in pc)b.D=window[c]&&window[c].prototype,pc[c].forEach(function(b){return function(c){return b.D&&c&&A(b.D,c,a)}}(b)),b={D:b.D}};function Z(a){this.node=a}m=Z.prototype;m.addEventListener=function(a,b,c){return this.node.__shady_addEventListener(a,b,c)};m.removeEventListener=function(a,b,c){return this.node.__shady_removeEventListener(a,b,c)};m.appendChild=function(a){return this.node.__shady_appendChild(a)};m.insertBefore=function(a,b){return this.node.__shady_insertBefore(a,b)};m.removeChild=function(a){return this.node.__shady_removeChild(a)};m.replaceChild=function(a,b){return this.node.__shady_replaceChild(a,b)};
var pc={EventTarget:[ec],Node:[J,window.EventTarget?null:ec],Text:[fc],Element:[jc,K,fc,!v.c||"innerHTML"in Element.prototype?jb:null,window.HTMLSlotElement?null:lc],HTMLElement:[kc,Y],HTMLSlotElement:[lc],DocumentFragment:[Ya,Za],Document:[nc,Ya,Za,$a],Window:[oc]},qc=v.c?null:["innerHTML","textContent"];function rc(a){var b=a?null:qc,c={},d;for(d in pc)c.D=window[d]&&window[d].prototype,pc[d].forEach(function(c){return function(d){return c.D&&d&&A(c.D,d,a,b)}}(c)),c={D:c.D}};function Z(a){this.node=a}m=Z.prototype;m.addEventListener=function(a,b,c){return this.node.__shady_addEventListener(a,b,c)};m.removeEventListener=function(a,b,c){return this.node.__shady_removeEventListener(a,b,c)};m.appendChild=function(a){return this.node.__shady_appendChild(a)};m.insertBefore=function(a,b){return this.node.__shady_insertBefore(a,b)};m.removeChild=function(a){return this.node.__shady_removeChild(a)};m.replaceChild=function(a,b){return this.node.__shady_replaceChild(a,b)};
m.cloneNode=function(a){return this.node.__shady_cloneNode(a)};m.getRootNode=function(a){return this.node.__shady_getRootNode(a)};m.contains=function(a){return this.node.__shady_contains(a)};m.dispatchEvent=function(a){return this.node.__shady_dispatchEvent(a)};m.setAttribute=function(a,b){this.node.__shady_setAttribute(a,b)};m.getAttribute=function(a){return this.node.__shady_native_getAttribute(a)};m.removeAttribute=function(a){this.node.__shady_removeAttribute(a)};m.attachShadow=function(a){return this.node.__shady_attachShadow(a)};

@@ -95,6 +95,6 @@ m.focus=function(){this.node.__shady_native_focus()};m.blur=function(){this.node.__shady_blur()};m.importNode=function(a,b){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_importNode(a,b)};m.getElementById=function(a){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_getElementById(a)};m.querySelector=function(a){return this.node.__shady_querySelector(a)};m.querySelectorAll=function(a,b){return this.node.__shady_querySelectorAll(a,b)};

childElementCount:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childElementCount}},shadowRoot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_shadowRoot}},assignedSlot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_assignedSlot}},isConnected:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_isConnected}},innerHTML:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_innerHTML},set:function(a){this.node.__shady_innerHTML=
a}},textContent:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_textContent},set:function(a){this.node.__shady_textContent=a}},slot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_slot},set:function(a){this.node.__shady_slot=a}}});Wb.forEach(function(a){Object.defineProperty(Z.prototype,a,{get:function(){return this.node["__shady_"+a]},set:function(b){this.node["__shady_"+a]=b},configurable:!0})});var rc=new WeakMap;
function sc(a){if(x(a)||a instanceof Z)return a;var b=rc.get(a);b||(b=new Z(a),rc.set(a,b));return b};v.J&&(window.ShadyDOM={inUse:v.J,patch:function(a){Da(a);Ca(a);return a},isShadyRoot:x,enqueue:ya,flush:D,settings:v,filterMutations:Ab,observeChildren:yb,unobserveChildren:zb,deferConnectionCallbacks:v.deferConnectionCallbacks,preferPerformance:v.preferPerformance,handlesDynamicScoping:!0,wrap:v.m?sc:function(a){return a},Wrapper:Z,composedPath:Fb,noPatch:v.m,nativeMethods:Xb,nativeTree:Yb},dc(),qc("__shady_"),Object.defineProperty(document,"_activeElement",$a.activeElement),A(Window.prototype,oc,
"__shady_"),v.m||(qc(),Vb()),Qb(),window.Event=Sb,window.CustomEvent=Tb,window.MouseEvent=Ub,window.ShadowRoot=N);}).call(this);
a}},textContent:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_textContent},set:function(a){this.node.__shady_textContent=a}},slot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_slot},set:function(a){this.node.__shady_slot=a}}});Wb.forEach(function(a){Object.defineProperty(Z.prototype,a,{get:function(){return this.node["__shady_"+a]},set:function(b){this.node["__shady_"+a]=b},configurable:!0})});var sc=new WeakMap;
function tc(a){if(x(a)||a instanceof Z)return a;var b=sc.get(a);b||(b=new Z(a),sc.set(a,b));return b};v.J&&(window.ShadyDOM={inUse:v.J,patch:function(a){Da(a);Ca(a);return a},isShadyRoot:x,enqueue:ya,flush:D,settings:v,filterMutations:Ab,observeChildren:yb,unobserveChildren:zb,deferConnectionCallbacks:v.deferConnectionCallbacks,preferPerformance:v.preferPerformance,handlesDynamicScoping:!0,wrap:v.m?tc:function(a){return a},Wrapper:Z,composedPath:Fb,noPatch:v.m,nativeMethods:Xb,nativeTree:Yb},dc(),rc("__shady_"),Object.defineProperty(document,"_activeElement",$a.activeElement),A(Window.prototype,oc,
"__shady_"),v.m||(rc(),Vb()),Qb(),window.Event=Sb,window.CustomEvent=Tb,window.MouseEvent=Ub,window.ShadowRoot=N);}).call(this);
//# sourceMappingURL=shadydom.min.js.map

@@ -65,7 +65,13 @@ /**

// Note, must avoid patching accessors on prototypes when descriptors are not correct
// because the CustomElements polyfill checks if these exist before patching instances.
// CustomElements polyfill *only* cares about these accessors.
const disallowedNativePatches = utils.settings.hasDescriptors ? null : ['innerHTML', 'textContent'];
export const applyPatches = (prefix) => {
const disallowed = prefix ? null : disallowedNativePatches;
for (let p in patchMap) {
const proto = getPatchPrototype(p);
patchMap[p].forEach(patch => proto && patch &&
utils.patchProperties(proto, patch, prefix));
utils.patchProperties(proto, patch, prefix, disallowed));
}

@@ -72,0 +78,0 @@ }

@@ -143,6 +143,10 @@ /**

* @param {boolean=} force
* @param {Array=} disallowedPatches
*/
export const patchProperties = (proto, descriptors, prefix = '') => {
export const patchProperties = (proto, descriptors, prefix = '', disallowedPatches) => {
for (let p in descriptors) {
const newDescriptor = descriptors[p];
if (disallowedPatches && disallowedPatches.indexOf(p) >= 0) {
continue;
}
newDescriptor.configurable = true;

@@ -149,0 +153,0 @@ const name = prefix + p;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc