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

as-custom-element

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

as-custom-element - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

2

cjs/index.js
'use strict';
const asCE = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('@webreflection/as-custom-element'));
module.exports = asCE(['*'], document);
module.exports = asCE(document, () => {});

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

self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var a=((e,a)=>{const r=new WeakMap,n=e=>{for(let t=0,{length:a}=e;t<a;t++){const{target:a,attributeName:n,oldValue:l}=e[t],o=a.getAttribute(n);r.get(a).a[n].forEach(e=>{e.call(a,n,l,o)})}},l=(a,n,o,c)=>{for(let s=0,{length:d}=a;s<d;s++){const d=a[s];o.has(d)||!c&&!("querySelectorAll"in d)||(o.add(d),r.has(d)&&r.get(d)[n].forEach(t,d),e.length&&l(d.querySelectorAll(e),n,o,!0))}},o=e=>{for(let t=0,{length:a}=e;t<a;t++){const{addedNodes:a,removedNodes:r}=e[t];l(a,"c",new Set,!1),n(c.takeRecords()),l(r,"d",new Set,!1)}},c=new MutationObserver(n),s=new MutationObserver(o);return s.observe(a,{childList:!0,subtree:!0}),(e,{connectedCallback:t,disconnectedCallback:a,observedAttributes:n,attributeChangedCallback:l})=>{o(s.takeRecords());const{a:d,c:u,d:i}=r.get(e)||(e=>{const t={a:{},c:new Set,d:new Set};return r.set(e,t),t})(e);return n&&(c.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:n}),n.forEach(t=>{(d[t]||(d[t]=new Set)).add(l),e.hasAttribute(t)&&l.call(e,t,null,e.getAttribute(t))})),a&&i.add(a),t&&(u.add(t),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||t.call(e)),e}})(["*"],document);return e.default=a,e}({}).default;
self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var a=((e,a)=>{const r=new WeakMap,n=e=>{for(let t=0,{length:a}=e;t<a;t++){const{target:a,attributeName:n,oldValue:o}=e[t],c=a.getAttribute(n);r.get(a).a[n].forEach(e=>{e.call(a,n,o,c)})}},o=(e,n,c,l)=>{for(let s=0,{length:d}=e;s<d;s++){const d=e[s];c.has(d)||!l&&!("querySelectorAll"in d)||(c.add(d),r.has(d)?r.get(d)[n].forEach(t,d):"c"===n&&a(d,c),o(d.querySelectorAll("*"),n,c,!0))}},c=e=>{for(let t=0,{length:a}=e;t<a;t++){const{addedNodes:a,removedNodes:r}=e[t];o(a,"c",new Set,!1),n(l.takeRecords()),o(r,"d",new Set,!1)}},l=new MutationObserver(n),s=new MutationObserver(c);return s.observe(e,{childList:!0,subtree:!0}),(e,{connectedCallback:t,disconnectedCallback:a,observedAttributes:n,attributeChangedCallback:o})=>{c(s.takeRecords());const{a:d,c:u,d:i}=r.get(e)||(e=>{const t={a:{},c:new Set,d:new Set};return r.set(e,t),t})(e);return n&&(l.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:n}),n.forEach(t=>{(d[t]||(d[t]=new Set)).add(o),e.hasAttribute(t)&&o.call(e,t,null,e.getAttribute(t))})),a&&i.add(a),t&&(u.add(t),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||t.call(e)),e}})(document,()=>{});return e.default=a,e}({}).default;
import asCE from '@webreflection/as-custom-element';
export default asCE(['*'], document);
export default asCE(document, () => {});
self.asCustomElement = (function (exports) {
'use strict';
var asCE = (function (selectors, root) {
var asCE = (function (root, setup) {
var wm = new WeakMap();

@@ -24,10 +24,10 @@

var invoke = function invoke(nodes, key, parsed, noCheck) {
var invoke = function invoke(nodes, key, parsed, isQSA) {
for (var i = 0, length = nodes.length; i < length; i++) {
var target = nodes[i];
if (!parsed.has(target) && (noCheck || 'querySelectorAll' in target)) {
if (!parsed.has(target) && (isQSA || 'querySelectorAll' in target)) {
parsed.add(target);
if (wm.has(target)) wm.get(target)[key].forEach(call, target);
if (selectors.length) invoke(target.querySelectorAll(selectors), key, parsed, true);
if (wm.has(target)) wm.get(target)[key].forEach(call, target);else if (key === 'c') setup(target, parsed);
invoke(target.querySelectorAll('*'), key, parsed, true);
}

@@ -103,3 +103,3 @@ }

var index = asCE(['*'], document);
var index = asCE(document, function () {});

@@ -106,0 +106,0 @@ exports.default = index;

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

self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var a,r,n,o,c,u,l,i,d=(a=["*"],r=document,n=new WeakMap,o=function(e){for(var t=function(t,a){var r=e[t],o=r.target,c=r.attributeName,u=r.oldValue,l=o.getAttribute(c);n.get(o).a[c].forEach((function(e){e.call(o,c,u,l)}))},a=0,r=e.length;a<r;a++)t(a)},c=function e(r,o,c,u){for(var l=0,i=r.length;l<i;l++){var d=r[l];c.has(d)||!u&&!("querySelectorAll"in d)||(c.add(d),n.has(d)&&n.get(d)[o].forEach(t,d),a.length&&e(d.querySelectorAll(a),o,c,!0))}},u=function(e){for(var t=0,a=e.length;t<a;t++){var r=e[t],n=r.addedNodes,u=r.removedNodes;c(n,"c",new Set,!1),o(l.takeRecords()),c(u,"d",new Set,!1)}},l=new MutationObserver(o),(i=new MutationObserver(u)).observe(r,{childList:!0,subtree:!0}),function(e,t){var a=t.connectedCallback,r=t.disconnectedCallback,o=t.observedAttributes,c=t.attributeChangedCallback;u(i.takeRecords());var d=n.get(e)||function(e){var t={a:{},c:new Set,d:new Set};return n.set(e,t),t}(e),s=d.a,b=d.c,f=d.d;return o&&(l.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:o}),o.forEach((function(t){(s[t]||(s[t]=new Set)).add(c),e.hasAttribute(t)&&c.call(e,t,null,e.getAttribute(t))}))),r&&f.add(r),a&&(b.add(a),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||a.call(e)),e});return e.default=d,e}({}).default;
self.asCustomElement=function(e){"use strict";function t(e){e.call(this)}var a,n,r,o,c,u,l,i,d=(a=document,n=function(){},r=new WeakMap,o=function(e){for(var t=function(t,a){var n=e[t],o=n.target,c=n.attributeName,u=n.oldValue,l=o.getAttribute(c);r.get(o).a[c].forEach((function(e){e.call(o,c,u,l)}))},a=0,n=e.length;a<n;a++)t(a)},c=function e(a,o,c,u){for(var l=0,i=a.length;l<i;l++){var d=a[l];c.has(d)||!u&&!("querySelectorAll"in d)||(c.add(d),r.has(d)?r.get(d)[o].forEach(t,d):"c"===o&&n(d,c),e(d.querySelectorAll("*"),o,c,!0))}},u=function(e){for(var t=0,a=e.length;t<a;t++){var n=e[t],r=n.addedNodes,u=n.removedNodes;c(r,"c",new Set,!1),o(l.takeRecords()),c(u,"d",new Set,!1)}},l=new MutationObserver(o),(i=new MutationObserver(u)).observe(a,{childList:!0,subtree:!0}),function(e,t){var a=t.connectedCallback,n=t.disconnectedCallback,o=t.observedAttributes,c=t.attributeChangedCallback;u(i.takeRecords());var d=r.get(e)||function(e){var t={a:{},c:new Set,d:new Set};return r.set(e,t),t}(e),s=d.a,f=d.c,b=d.d;return o&&(l.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:o}),o.forEach((function(t){(s[t]||(s[t]=new Set)).add(c),e.hasAttribute(t)&&c.call(e,t,null,e.getAttribute(t))}))),n&&b.add(n),a&&(f.add(a),e.ownerDocument.compareDocumentPosition(e)&e.DOCUMENT_POSITION_DISCONNECTED||a.call(e)),e});return e.default=d,e}({}).default;
{
"name": "as-custom-element",
"version": "0.3.2",
"version": "0.3.3",
"description": "Setup any element as if it was a Custom Element",

@@ -51,4 +51,4 @@ "main": "./cjs/index.js",

"dependencies": {
"@webreflection/as-custom-element": "^0.1.3"
"@webreflection/as-custom-element": "^0.1.4"
}
}
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