qsa-observer
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,1 +0,1 @@ | ||
self.qsaObserver=function(e){"use strict";const t=!0,l=!1,r="querySelectorAll",o="querySelectorAll",{document:s,MutationObserver:d,Set:n,WeakMap:a}=self,c=e=>o in e,{filter:h}=[];return e.default=e=>{const u=new a,f=(t,l)=>{let r;if(l)for(let o,s=(e=>e.matches||e.webkitMatchesSelector||e.msMatchesSelector)(t),d=0,{length:a}=g;d<a;d++)s.call(t,o=g[d])&&(u.has(t)||u.set(t,new n),r=u.get(t),r.has(o)||(r.add(o),e.handle(t,l,o)));else u.has(t)&&(r=u.get(t),u.delete(t),r.forEach((r=>{e.handle(t,l,r)})))},i=(e,t=!0)=>{for(let l=0,{length:r}=e;l<r;l++)f(e[l],t)},{query:g}=e,v=e.root||s,b=((e,o,s)=>{const d=(l,o,s,n,a)=>{for(let c=0,{length:h}=l;c<h;c++){const h=l[c];(a||r in h)&&(n?o.has(h)||(o.add(h),s.delete(h),e(h,n)):s.has(h)||(s.add(h),o.delete(h),e(h,n)),a||d((h.shadowRoot||h)[r]("*"),o,s,n,t))}},n=new(s||MutationObserver)((e=>{for(let r=new Set,o=new Set,s=0,{length:n}=e;s<n;s++){const{addedNodes:n,removedNodes:a}=e[s];d(a,r,o,l,l),d(n,r,o,t,l)}}));return n.observe(o||document,{subtree:t,childList:t}),n})(f,v,d);return g.length&&i(v[o](g)),{drop:e=>{for(let t=0,{length:l}=e;t<l;t++)u.delete(e[t])},flush:()=>{const e=b.takeRecords();for(let t=0,{length:l}=e;t<l;t++)i(h.call(e[t].removedNodes,c),!1),i(h.call(e[t].addedNodes,c),!0)},observer:b,parse:i}},e}({}).default; | ||
self.qsaObserver=function(e){"use strict";const t=!0,l=!1,r="querySelectorAll";function s(e){this.observe(e,{subtree:t,childList:t})}const o="querySelectorAll",{document:d,MutationObserver:n,Set:a,WeakMap:c}=self,h=e=>o in e,{filter:u}=[];return e.default=e=>{const f=new c,i=(t,l)=>{let r;if(l)for(let s,o=(e=>e.matches||e.webkitMatchesSelector||e.msMatchesSelector)(t),d=0,{length:n}=v;d<n;d++)o.call(t,s=v[d])&&(f.has(t)||f.set(t,new a),r=f.get(t),r.has(s)||(r.add(s),e.handle(t,l,s)));else f.has(t)&&(r=f.get(t),f.delete(t),r.forEach((r=>{e.handle(t,l,r)})))},g=(e,t=!0)=>{for(let l=0,{length:r}=e;l<r;l++)i(e[l],t)},{query:v}=e,b=e.root||d,S=((e,o,d)=>{const n=(l,s,o,d,a)=>{for(let c=0,{length:h}=l;c<h;c++){const h=l[c];(a||r in h)&&(d?s.has(h)||(s.add(h),o.delete(h),e(h,d)):o.has(h)||(o.add(h),s.delete(h),e(h,d)),a||n(h[r]("*"),s,o,d,t))}},a=new(d||MutationObserver)((e=>{for(let r=new Set,s=new Set,o=0,{length:d}=e;o<d;o++){const{addedNodes:d,removedNodes:a}=e[o];n(a,r,s,l,l),n(d,r,s,t,l)}}));return a.add=s,a.add(o||document),a})(i,b,n);return v.length&&g(b[o](v)),{drop:e=>{for(let t=0,{length:l}=e;t<l;t++)f.delete(e[t])},flush:()=>{const e=S.takeRecords();for(let t=0,{length:l}=e;t<l;t++)g(u.call(e[t].removedNodes,h),!1),g(u.call(e[t].addedNodes,h),!0)},observer:S,parse:g}},e}({}).default; |
16
index.js
@@ -7,2 +7,9 @@ self.qsaObserver = (function (exports) { | ||
var QSA$1 = 'querySelectorAll'; | ||
function add(node) { | ||
this.observe(node, { | ||
subtree: TRUE, | ||
childList: TRUE | ||
}); | ||
} | ||
/** | ||
@@ -16,2 +23,3 @@ * Start observing a generic document or root element. | ||
var notify = function notify(callback, root, MO) { | ||
@@ -35,3 +43,3 @@ var loop = function loop(nodes, added, removed, connected, pass) { | ||
if (!pass) loop((node.shadowRoot || node)[QSA$1]('*'), added, removed, connected, TRUE); | ||
if (!pass) loop(node[QSA$1]('*'), added, removed, connected, TRUE); | ||
} | ||
@@ -50,6 +58,4 @@ } | ||
}); | ||
observer.observe(root || document, { | ||
subtree: TRUE, | ||
childList: TRUE | ||
}); | ||
observer.add = add; | ||
observer.add(root || document); | ||
return observer; | ||
@@ -56,0 +62,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
self.qsaObserver=function(e){"use strict";var t=!0,r=!1,n="querySelectorAll",o="querySelectorAll",a=self,l=a.document,d=a.MutationObserver,s=a.Set,c=a.WeakMap,u=function(e){return o in e},f=[].filter;return e.default=function(e){var a=new c,i=function(t,r){var n;if(r)for(var o,l=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector}(t),d=0,c=v.length;d<c;d++)l.call(t,o=v[d])&&(a.has(t)||a.set(t,new s),(n=a.get(t)).has(o)||(n.add(o),e.handle(t,r,o)));else a.has(t)&&(n=a.get(t),a.delete(t),n.forEach((function(n){e.handle(t,r,n)})))},h=function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,n=e.length;r<n;r++)i(e[r],t)},v=e.query,g=e.root||l,b=function(e,o,a){var l=function r(o,a,l,d,s){for(var c=0,u=o.length;c<u;c++){var f=o[c];(s||n in f)&&(d?a.has(f)||(a.add(f),l.delete(f),e(f,d)):l.has(f)||(l.add(f),a.delete(f),e(f,d)),s||r((f.shadowRoot||f)[n]("*"),a,l,d,t))}},d=new(a||MutationObserver)((function(e){for(var n=new Set,o=new Set,a=0,d=e.length;a<d;a++){var s=e[a],c=s.addedNodes,u=s.removedNodes;l(u,n,o,r,r),l(c,n,o,t,r)}}));return d.observe(o||document,{subtree:t,childList:t}),d}(i,g,d);return v.length&&h(g[o](v)),{drop:function(e){for(var t=0,r=e.length;t<r;t++)a.delete(e[t])},flush:function(){for(var e=b.takeRecords(),t=0,r=e.length;t<r;t++)h(f.call(e[t].removedNodes,u),!1),h(f.call(e[t].addedNodes,u),!0)},observer:b,parse:h}},e}({}).default; | ||
self.qsaObserver=function(e){"use strict";var t=!0,r=!1,n="querySelectorAll";function a(e){this.observe(e,{subtree:t,childList:t})}var o="querySelectorAll",d=self,l=d.document,s=d.MutationObserver,c=d.Set,u=d.WeakMap,f=function(e){return o in e},i=[].filter;return e.default=function(e){var d=new u,h=function(t,r){var n;if(r)for(var a,o=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector}(t),l=0,s=g.length;l<s;l++)o.call(t,a=g[l])&&(d.has(t)||d.set(t,new c),(n=d.get(t)).has(a)||(n.add(a),e.handle(t,r,a)));else d.has(t)&&(n=d.get(t),d.delete(t),n.forEach((function(n){e.handle(t,r,n)})))},v=function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,n=e.length;r<n;r++)h(e[r],t)},g=e.query,b=e.root||l,S=function(e,o,d){var l=function r(a,o,d,l,s){for(var c=0,u=a.length;c<u;c++){var f=a[c];(s||n in f)&&(l?o.has(f)||(o.add(f),d.delete(f),e(f,l)):d.has(f)||(d.add(f),o.delete(f),e(f,l)),s||r(f[n]("*"),o,d,l,t))}},s=new(d||MutationObserver)((function(e){for(var n=new Set,a=new Set,o=0,d=e.length;o<d;o++){var s=e[o],c=s.addedNodes,u=s.removedNodes;l(u,n,a,r,r),l(c,n,a,t,r)}}));return s.add=a,s.add(o||document),s}(h,b,s);return g.length&&v(b[o](g)),{drop:function(e){for(var t=0,r=e.length;t<r;t++)d.delete(e[t])},flush:function(){for(var e=S.takeRecords(),t=0,r=e.length;t<r;t++)v(i.call(e[t].removedNodes,f),!1),v(i.call(e[t].addedNodes,f),!0)},observer:S,parse:v}},e}({}).default; |
{ | ||
"name": "qsa-observer", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "handle elements lifecycle through CSS selectors", | ||
@@ -22,10 +22,10 @@ "main": "./cjs/index.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.13.15", | ||
"@babel/preset-env": "^7.13.15", | ||
"@babel/core": "^7.14.0", | ||
"@babel/preset-env": "^7.14.1", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-node-resolve": "^11.2.1", | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"ascjs": "^5.0.1", | ||
"rollup": "^2.45.2", | ||
"rollup": "^2.47.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"terser": "^5.6.1" | ||
"terser": "^5.7.0" | ||
}, | ||
@@ -51,4 +51,4 @@ "module": "./esm/index.js", | ||
"dependencies": { | ||
"element-notifier": "^0.1.2" | ||
"element-notifier": "^0.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14776
240
0
+ Addedelement-notifier@0.2.0(transitive)
- Removedelement-notifier@0.1.2(transitive)
Updatedelement-notifier@^0.2.0