Socket
Socket
Sign inDemoInstall

@webreflection/custom-elements-builtin

Package Overview
Dependencies
2
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.20 to 0.1.21

7

cjs/index.js

@@ -135,7 +135,7 @@ 'use strict';

const tag = options && options.extends;
if (getCE(is))
throw new Error(`'${is}' has already been defined as a custom element`);
classes.set(Class, tag ? {is, tag} : {is: '', tag: is});
if (tag) {
if (getCE(is))
throw new Error(`'${is}' has already been defined as a custom element`);
selector = `${tag}[is="${is}"]`;
classes.set(Class, {is, tag});
prototypes.set(selector, Class.prototype);

@@ -147,3 +147,2 @@ registry.set(is, Class);

define.apply(customElements, arguments);
classes.set(Class, {is: '', tag: is});
shadowed.push(selector = is);

@@ -150,0 +149,0 @@ }

@@ -1,1 +0,1 @@

!function(){"use strict";const{document:e,MutationObserver:t,Set:r,WeakMap:l}=self,n=e=>"querySelectorAll"in e,{filter:o}=[];var s=s=>{const a=new l,c=e=>{const{query:t}=s;if(t.length)for(let r=0,{length:l}=e;r<l;r++)u(o.call(e[r].addedNodes,n),!0,t),u(o.call(e[r].removedNodes,n),!1,t)},u=(e,t,l,n=new r)=>{for(let o,c,h=0,{length:d}=e;h<d;h++)if(!n.has(c=e[h])){if(n.add(c),t)for(let e,n=i(c),u=0,{length:h}=l;u<h;u++)n.call(c,e=l[u])&&(a.has(c)||a.set(c,new r),o=a.get(c),o.has(e)||(o.add(e),s.handle(c,t,e)));else a.has(c)&&(o=a.get(c),a.delete(c),o.forEach((e=>{s.handle(c,t,e)})));u(f(c),t,l,n)}},i=e=>e.matches||e.webkitMatchesSelector||e.msMatchesSelector,h=(e,t=!0)=>{u(e,t,s.query)},f=e=>p.length?e.querySelectorAll(p):p,d=new t(c),g=s.root||e,{query:p}=s;return d.observe(g,{childList:!0,subtree:!0}),h(f(g)),{drop:e=>{for(let t=0,{length:r}=e;t<r;t++)a.delete(e[t])},flush:()=>{c(d.takeRecords())},observer:d,parse:h}};const{customElements:a,document:c,Element:u,MutationObserver:i,Object:h,Promise:f,Map:d,Set:g,WeakMap:p,Reflect:y}=self,{attachShadow:b}=u.prototype,{createElement:w}=c,{define:m,get:v}=a,{construct:q}=y||{construct(e){return e.call(this)}},{defineProperty:S,getOwnPropertyNames:A,setPrototypeOf:E}=h,M=new p,O=new g,k=new d,N=new d,P=new d,$=new d,C=[],V=[],L=e=>$.get(e)||v.call(a,e),R=(e,t,r)=>{const l=P.get(r);if(t&&!l.isPrototypeOf(e)){x=E(e,l);try{new l.constructor}finally{x=null}}const n=(t?"":"dis")+"connectedCallback";n in l&&e[n]()},{parse:T}=s({query:V,handle:R}),{parse:W}=s({query:C,handle(e,t){M.has(e)&&(t?O.add(e):O.delete(e),D.call(V,e))}}),_=e=>{if(!N.has(e)){let t,r=new f((e=>{t=e}));N.set(e,{$:r,_:t})}return N.get(e).$},j=((e,t)=>{const r=e=>{for(let t=0,{length:r}=e;t<r;t++)l(e[t])},l=({target:e,attributeName:t,oldValue:r})=>{e.attributeChangedCallback(t,r,e.getAttribute(t))};return(n,o)=>{const{observedAttributes:s}=n.constructor;return s&&e(o).then((()=>{new t(r).observe(n,{attributes:!0,attributeOldValue:!0,attributeFilter:s});for(let e=0,{length:t}=s;e<t;e++)n.hasAttribute(s[e])&&l({target:n,attributeName:s[e],oldValue:null})})),n}})(_,i);let x=null;function D(e){const{parse:t,root:r}=M.get(e);t(r.querySelectorAll(this),e.isConnected)}A(self).filter((e=>/^HTML/.test(e))).forEach((e=>{const t=self[e];function r(){const{constructor:e}=this;if(!k.has(e))throw new TypeError("Illegal constructor");const{is:r,tag:l}=k.get(e);if(r){if(x)return j(x,r);const t=w.call(c,l);return t.setAttribute("is",r),j(E(t,e.prototype),r)}return q.call(this,t,[],e)}E(r,t),(r.prototype=t.prototype).constructor=r,S(self,e,{value:r})})),S(c,"createElement",{value(e,t){const r=t&&t.is;if(r){const t=$.get(r);if(t&&k.get(t).tag===e)return new t}const l=w.call(c,e);return r&&l.setAttribute("is",r),l}}),b&&S(u.prototype,"attachShadow",{value(){const e=b.apply(this,arguments),{parse:t}=s({query:V,root:e,handle:R});return M.set(this,{root:e,parse:t}),e}}),S(a,"get",{configurable:!0,value:L}),S(a,"whenDefined",{configurable:!0,value:_}),S(a,"define",{configurable:!0,value(e,t,r){let l;const n=r&&r.extends;if(n){if(L(e))throw new Error(`'${e}' has already been defined as a custom element`);l=`${n}[is="${e}"]`,k.set(t,{is:e,tag:n}),P.set(l,t.prototype),$.set(e,t),V.push(l)}else m.apply(a,arguments),k.set(t,{is:"",tag:e}),C.push(l=e);_(e).then((()=>{n?(T(c.querySelectorAll(l)),O.forEach(D,[l])):W(c.querySelectorAll(l))})),N.get(e)._(t)}})}();
!function(){"use strict";const{document:e,MutationObserver:t,Set:r,WeakMap:l}=self,n=e=>"querySelectorAll"in e,{filter:o}=[];var s=s=>{const a=new l,c=e=>{const{query:t}=s;if(t.length)for(let r=0,{length:l}=e;r<l;r++)u(o.call(e[r].addedNodes,n),!0,t),u(o.call(e[r].removedNodes,n),!1,t)},u=(e,t,l,n=new r)=>{for(let o,c,h=0,{length:f}=e;h<f;h++)if(!n.has(c=e[h])){if(n.add(c),t)for(let e,n=i(c),u=0,{length:h}=l;u<h;u++)n.call(c,e=l[u])&&(a.has(c)||a.set(c,new r),o=a.get(c),o.has(e)||(o.add(e),s.handle(c,t,e)));else a.has(c)&&(o=a.get(c),a.delete(c),o.forEach((e=>{s.handle(c,t,e)})));u(d(c),t,l,n)}},i=e=>e.matches||e.webkitMatchesSelector||e.msMatchesSelector,h=(e,t=!0)=>{u(e,t,s.query)},d=e=>p.length?e.querySelectorAll(p):p,f=new t(c),g=s.root||e,{query:p}=s;return f.observe(g,{childList:!0,subtree:!0}),h(d(g)),{drop:e=>{for(let t=0,{length:r}=e;t<r;t++)a.delete(e[t])},flush:()=>{c(f.takeRecords())},observer:f,parse:h}};const{customElements:a,document:c,Element:u,MutationObserver:i,Object:h,Promise:d,Map:f,Set:g,WeakMap:p,Reflect:y}=self,{attachShadow:b}=u.prototype,{createElement:w}=c,{define:m,get:v}=a,{construct:q}=y||{construct(e){return e.call(this)}},{defineProperty:S,getOwnPropertyNames:A,setPrototypeOf:E}=h,M=new p,O=new g,k=new f,N=new f,P=new f,$=new f,C=[],V=[],L=e=>$.get(e)||v.call(a,e),R=(e,t,r)=>{const l=P.get(r);if(t&&!l.isPrototypeOf(e)){x=E(e,l);try{new l.constructor}finally{x=null}}const n=(t?"":"dis")+"connectedCallback";n in l&&e[n]()},{parse:T}=s({query:V,handle:R}),{parse:W}=s({query:C,handle(e,t){M.has(e)&&(t?O.add(e):O.delete(e),D.call(V,e))}}),_=e=>{if(!N.has(e)){let t,r=new d((e=>{t=e}));N.set(e,{$:r,_:t})}return N.get(e).$},j=((e,t)=>{const r=e=>{for(let t=0,{length:r}=e;t<r;t++)l(e[t])},l=({target:e,attributeName:t,oldValue:r})=>{e.attributeChangedCallback(t,r,e.getAttribute(t))};return(n,o)=>{const{observedAttributes:s}=n.constructor;return s&&e(o).then((()=>{new t(r).observe(n,{attributes:!0,attributeOldValue:!0,attributeFilter:s});for(let e=0,{length:t}=s;e<t;e++)n.hasAttribute(s[e])&&l({target:n,attributeName:s[e],oldValue:null})})),n}})(_,i);let x=null;function D(e){const{parse:t,root:r}=M.get(e);t(r.querySelectorAll(this),e.isConnected)}A(self).filter((e=>/^HTML/.test(e))).forEach((e=>{const t=self[e];function r(){const{constructor:e}=this;if(!k.has(e))throw new TypeError("Illegal constructor");const{is:r,tag:l}=k.get(e);if(r){if(x)return j(x,r);const t=w.call(c,l);return t.setAttribute("is",r),j(E(t,e.prototype),r)}return q.call(this,t,[],e)}E(r,t),(r.prototype=t.prototype).constructor=r,S(self,e,{value:r})})),S(c,"createElement",{value(e,t){const r=t&&t.is;if(r){const t=$.get(r);if(t&&k.get(t).tag===e)return new t}const l=w.call(c,e);return r&&l.setAttribute("is",r),l}}),b&&S(u.prototype,"attachShadow",{value(){const e=b.apply(this,arguments),{parse:t}=s({query:V,root:e,handle:R});return M.set(this,{root:e,parse:t}),e}}),S(a,"get",{configurable:!0,value:L}),S(a,"whenDefined",{configurable:!0,value:_}),S(a,"define",{configurable:!0,value(e,t,r){let l;const n=r&&r.extends;if(L(e))throw new Error(`'${e}' has already been defined as a custom element`);k.set(t,n?{is:e,tag:n}:{is:"",tag:e}),n?(l=`${n}[is="${e}"]`,P.set(l,t.prototype),$.set(e,t),V.push(l)):(m.apply(a,arguments),C.push(l=e)),_(e).then((()=>{n?(T(c.querySelectorAll(l)),O.forEach(D,[l])):W(c.querySelectorAll(l))})),N.get(e)._(t)}})}();

@@ -134,7 +134,7 @@ import attributesObserver from '@webreflection/custom-elements-attributes';

const tag = options && options.extends;
if (getCE(is))
throw new Error(`'${is}' has already been defined as a custom element`);
classes.set(Class, tag ? {is, tag} : {is: '', tag: is});
if (tag) {
if (getCE(is))
throw new Error(`'${is}' has already been defined as a custom element`);
selector = `${tag}[is="${is}"]`;
classes.set(Class, {is, tag});
prototypes.set(selector, Class.prototype);

@@ -146,3 +146,2 @@ registry.set(is, Class);

define.apply(customElements, arguments);
classes.set(Class, {is: '', tag: is});
shadowed.push(selector = is);

@@ -149,0 +148,0 @@ }

@@ -240,7 +240,7 @@ (function () {

const tag = options && options.extends;
if (getCE(is))
throw new Error(`'${is}' has already been defined as a custom element`);
classes.set(Class, tag ? {is, tag} : {is: '', tag: is});
if (tag) {
if (getCE(is))
throw new Error(`'${is}' has already been defined as a custom element`);
selector = `${tag}[is="${is}"]`;
classes.set(Class, {is, tag});
prototypes.set(selector, Class.prototype);

@@ -252,3 +252,2 @@ registry.set(is, Class);

define.apply(customElements, arguments);
classes.set(Class, {is: '', tag: is});
shadowed.push(selector = is);

@@ -255,0 +254,0 @@ }

{
"name": "@webreflection/custom-elements-builtin",
"version": "0.1.20",
"version": "0.1.21",
"description": "A better custom-elements-builtin polyfill, Safari only",

@@ -5,0 +5,0 @@ "main": "./cjs/index.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc