Socket
Socket
Sign inDemoInstall

@webreflection/custom-elements-builtin

Package Overview
Dependencies
1
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

15

cjs/index.js

@@ -9,3 +9,2 @@ 'use strict';

const attributes = new WeakMap;
const shadowRoots = new WeakMap;

@@ -23,7 +22,7 @@

const attributeChanged = (records, o) => {
for (let h = attributes.get(o), i = 0, {length} = records; i < length; i++) {
const attributeChanged = records => {
for (let i = 0, {length} = records; i < length; i++) {
const {target, attributeName, oldValue} = records[i];
const newValue = target.getAttribute(attributeName);
h.call(target, attributeName, oldValue, newValue);
target.attributeChangedCallback(attributeName, oldValue, newValue);
}

@@ -35,5 +34,3 @@ };

if (attributeFilter) {
const {attributeChangedCallback} = element;
const o = new MutationObserver(attributeChanged);
o.observe(element, {
new MutationObserver(attributeChanged).observe(element, {
attributes: true,

@@ -43,8 +40,6 @@ attributeOldValue: true,

});
attributes.set(o, attributeChangedCallback);
whenDefined(is).then(() => {
attributeFilter.forEach(attributeName => {
if (element.hasAttribute(attributeName))
attributeChangedCallback.call(
element,
element.attributeChangedCallback(
attributeName,

@@ -51,0 +46,0 @@ null,

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

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

@@ -8,3 +8,2 @@ import qsaObserver from 'qsa-observer';

const attributes = new WeakMap;
const shadowRoots = new WeakMap;

@@ -22,7 +21,7 @@

const attributeChanged = (records, o) => {
for (let h = attributes.get(o), i = 0, {length} = records; i < length; i++) {
const attributeChanged = records => {
for (let i = 0, {length} = records; i < length; i++) {
const {target, attributeName, oldValue} = records[i];
const newValue = target.getAttribute(attributeName);
h.call(target, attributeName, oldValue, newValue);
target.attributeChangedCallback(attributeName, oldValue, newValue);
}

@@ -34,5 +33,3 @@ };

if (attributeFilter) {
const {attributeChangedCallback} = element;
const o = new MutationObserver(attributeChanged);
o.observe(element, {
new MutationObserver(attributeChanged).observe(element, {
attributes: true,

@@ -42,8 +39,6 @@ attributeOldValue: true,

});
attributes.set(o, attributeChangedCallback);
whenDefined(is).then(() => {
attributeFilter.forEach(attributeName => {
if (element.hasAttribute(attributeName))
attributeChangedCallback.call(
element,
element.attributeChangedCallback(
attributeName,

@@ -50,0 +45,0 @@ null,

@@ -78,3 +78,2 @@ (function () {

const attributes = new WeakMap;
const shadowRoots = new WeakMap;

@@ -92,7 +91,7 @@

const attributeChanged = (records, o) => {
for (let h = attributes.get(o), i = 0, {length} = records; i < length; i++) {
const attributeChanged = records => {
for (let i = 0, {length} = records; i < length; i++) {
const {target, attributeName, oldValue} = records[i];
const newValue = target.getAttribute(attributeName);
h.call(target, attributeName, oldValue, newValue);
target.attributeChangedCallback(attributeName, oldValue, newValue);
}

@@ -104,5 +103,3 @@ };

if (attributeFilter) {
const {attributeChangedCallback} = element;
const o = new MutationObserver(attributeChanged);
o.observe(element, {
new MutationObserver(attributeChanged).observe(element, {
attributes: true,

@@ -112,8 +109,6 @@ attributeOldValue: true,

});
attributes.set(o, attributeChangedCallback);
whenDefined(is).then(() => {
attributeFilter.forEach(attributeName => {
if (element.hasAttribute(attributeName))
attributeChangedCallback.call(
element,
element.attributeChangedCallback(
attributeName,

@@ -120,0 +115,0 @@ null,

{
"name": "@webreflection/custom-elements-builtin",
"version": "0.1.3",
"version": "0.1.4",
"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