qsa-observer
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -7,4 +7,5 @@ 'use strict'; | ||
const callback = records => { | ||
if (options.query.length) { | ||
for (let query = options.query.slice(0), i = 0, {length} = records; i < length; i++) { | ||
const {query} = options; | ||
if (query.length) { | ||
for (let i = 0, {length} = records; i < length; i++) { | ||
loop(filter.call(records[i].addedNodes, elements), true, query, new Set); | ||
@@ -36,3 +37,3 @@ loop(filter.call(records[i].removedNodes, elements), false, query, new Set); | ||
const parse = (elements, connected = true) => { | ||
loop(elements, connected, options.query.slice(0), new Set); | ||
loop(elements, connected, options.query, new Set); | ||
}; | ||
@@ -44,5 +45,6 @@ const observer = new MutationObserver(callback); | ||
finally { | ||
if (options.query.length) | ||
parse(root.querySelectorAll(options.query)); | ||
const {query} = options; | ||
if (query.length) | ||
parse(root.querySelectorAll(query)); | ||
} | ||
}; |
@@ -1,1 +0,1 @@ | ||
self.qsaObserver=function(e){"use strict";const t=e=>"querySelectorAll"in e,{filter:r}=[];return e.default=e=>{const l=l=>{if(e.query.length)for(let s=e.query.slice(0),c=0,{length:n}=l;c<n;c++)o(r.call(l[c].addedNodes,t),!0,s,new Set),o(r.call(l[c].removedNodes,t),!1,s,new Set)},s=()=>{l(a.takeRecords())},o=(t,r,l,s)=>{for(let n,a=0,{length:u}=t;a<u;a++)if(!s.has(n=t[a])){s.add(n);for(let t=c(n),s=0,{length:o}=l;s<o;s++)t.call(n,l[s])&&e.handle(n,r,l[s],s);o(n.querySelectorAll(l),r,l,s)}},c=e=>e.matches||e.webkitMatchesSelector||e.msMatchesSelector,n=(t,r=!0)=>{o(t,r,e.query.slice(0),new Set)},a=new MutationObserver(l),u=e.root||document;a.observe(u,{childList:!0,subtree:!0});try{return{flush:s,observer:a,parse:n}}finally{e.query.length&&n(u.querySelectorAll(e.query))}},e}({}).default; | ||
self.qsaObserver=function(e){"use strict";const t=e=>"querySelectorAll"in e,{filter:r}=[];return e.default=e=>{const l=l=>{const{query:o}=e;if(o.length)for(let e=0,{length:n}=l;e<n;e++)s(r.call(l[e].addedNodes,t),!0,o,new Set),s(r.call(l[e].removedNodes,t),!1,o,new Set)},o=()=>{l(a.takeRecords())},s=(t,r,l,o)=>{for(let c,a=0,{length:u}=t;a<u;a++)if(!o.has(c=t[a])){o.add(c);for(let t=n(c),o=0,{length:s}=l;o<s;o++)t.call(c,l[o])&&e.handle(c,r,l[o],o);s(c.querySelectorAll(l),r,l,o)}},n=e=>e.matches||e.webkitMatchesSelector||e.msMatchesSelector,c=(t,r=!0)=>{s(t,r,e.query,new Set)},a=new MutationObserver(l),u=e.root||document;a.observe(u,{childList:!0,subtree:!0});try{return{flush:o,observer:a,parse:c}}finally{const{query:t}=e;t.length&&c(u.querySelectorAll(t))}},e}({}).default; |
@@ -6,4 +6,5 @@ const elements = element => 'querySelectorAll' in element; | ||
const callback = records => { | ||
if (options.query.length) { | ||
for (let query = options.query.slice(0), i = 0, {length} = records; i < length; i++) { | ||
const {query} = options; | ||
if (query.length) { | ||
for (let i = 0, {length} = records; i < length; i++) { | ||
loop(filter.call(records[i].addedNodes, elements), true, query, new Set); | ||
@@ -35,3 +36,3 @@ loop(filter.call(records[i].removedNodes, elements), false, query, new Set); | ||
const parse = (elements, connected = true) => { | ||
loop(elements, connected, options.query.slice(0), new Set); | ||
loop(elements, connected, options.query, new Set); | ||
}; | ||
@@ -43,5 +44,6 @@ const observer = new MutationObserver(callback); | ||
finally { | ||
if (options.query.length) | ||
parse(root.querySelectorAll(options.query)); | ||
const {query} = options; | ||
if (query.length) | ||
parse(root.querySelectorAll(query)); | ||
} | ||
}; |
11
index.js
@@ -11,4 +11,6 @@ self.qsaObserver = (function (exports) { | ||
var callback = function callback(records) { | ||
if (options.query.length) { | ||
for (var query = options.query.slice(0), i = 0, length = records.length; i < length; i++) { | ||
var query = options.query; | ||
if (query.length) { | ||
for (var i = 0, length = records.length; i < length; i++) { | ||
loop(filter.call(records[i].addedNodes, elements), true, query, new Set()); | ||
@@ -44,3 +46,3 @@ loop(filter.call(records[i].removedNodes, elements), false, query, new Set()); | ||
var connected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
loop(elements, connected, options.query.slice(0), new Set()); | ||
loop(elements, connected, options.query, new Set()); | ||
}; | ||
@@ -62,3 +64,4 @@ | ||
} finally { | ||
if (options.query.length) parse(root.querySelectorAll(options.query)); | ||
var query = options.query; | ||
if (query.length) parse(root.querySelectorAll(query)); | ||
} | ||
@@ -65,0 +68,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
self.qsaObserver=function(e){"use strict";var r=function(e){return"querySelectorAll"in e},t=[].filter;return e.default=function(e){var n=function(n){if(e.query.length)for(var o=e.query.slice(0),u=0,c=n.length;u<c;u++)l(t.call(n[u].addedNodes,r),!0,o,new Set),l(t.call(n[u].removedNodes,r),!1,o,new Set)},l=function r(t,n,l,u){for(var c,a=0,s=t.length;a<s;a++)if(!u.has(c=t[a])){u.add(c);for(var i=o(c),f=0,d=l.length;f<d;f++)i.call(c,l[f])&&e.handle(c,n,l[f],f);r(c.querySelectorAll(l),n,l,u)}},o=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector},u=function(r){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];l(r,t,e.query.slice(0),new Set)},c=new MutationObserver(n),a=e.root||document;c.observe(a,{childList:!0,subtree:!0});try{return{flush:function(){n(c.takeRecords())},observer:c,parse:u}}finally{e.query.length&&u(a.querySelectorAll(e.query))}},e}({}).default; | ||
self.qsaObserver=function(e){"use strict";var r=function(e){return"querySelectorAll"in e},t=[].filter;return e.default=function(e){var n=function(n){var o=e.query;if(o.length)for(var a=0,u=n.length;a<u;a++)l(t.call(n[a].addedNodes,r),!0,o,new Set),l(t.call(n[a].removedNodes,r),!1,o,new Set)},l=function r(t,n,l,a){for(var u,c=0,s=t.length;c<s;c++)if(!a.has(u=t[c])){a.add(u);for(var i=o(u),f=0,d=l.length;f<d;f++)i.call(u,l[f])&&e.handle(u,n,l[f],f);r(u.querySelectorAll(l),n,l,a)}},o=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector},a=function(r){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];l(r,t,e.query,new Set)},u=new MutationObserver(n),c=e.root||document;u.observe(c,{childList:!0,subtree:!0});try{return{flush:function(){n(u.takeRecords())},observer:u,parse:a}}finally{var s=e.query;s.length&&a(c.querySelectorAll(s))}},e}({}).default; |
{ | ||
"name": "qsa-observer", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
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
152
0
9851