Comparing version 2.2.0 to 2.3.0
@@ -55,9 +55,29 @@ var domassist = (function (exports) { | ||
return; | ||
} | ||
} // scrolling events need the passive listener attached | ||
// to satisfy SEO scrolling measurements: | ||
var data = { | ||
cb: cb, | ||
capture: capture | ||
}; | ||
if (['touchstart', 'touchmove', 'wheel', 'mousewheel', 'scroll'].indexOf(event) !== -1) { | ||
if (capture === false) { | ||
capture = { | ||
passive: true | ||
}; | ||
} | ||
if (capture === true) { | ||
capture = { | ||
passive: true, | ||
capture: true | ||
}; | ||
} | ||
if (typeof capture === 'object') { | ||
capture.passive = true; | ||
} | ||
} // _domassistevents keeps track of events we registered | ||
// with 'domassist.on' so they can be deregistered by | ||
// 'domassist.off' without affecting events registered | ||
// by other libraries: | ||
if (!window._domassistevents) { | ||
@@ -67,3 +87,6 @@ window._domassistevents = {}; | ||
window._domassistevents["_" + event] = data; | ||
window._domassistevents["_" + event] = { | ||
cb: cb, | ||
capture: capture | ||
}; | ||
var el = find(selector); | ||
@@ -232,12 +255,9 @@ | ||
if (!window._domassistevents) { | ||
window._domassistevents = {}; | ||
} | ||
if (!window._domassistevents || !window._domassistevents["_" + event]) { | ||
return; | ||
} // only disable events that were registered with domassist.on, | ||
// don't de-register events that were registered by other libs: | ||
var data = window._domassistevents["_" + event]; | ||
if (!data) { | ||
return; | ||
} | ||
var el = find(selector); | ||
@@ -244,0 +264,0 @@ |
@@ -52,9 +52,29 @@ function isWindow(obj) { | ||
return; | ||
} | ||
} // scrolling events need the passive listener attached | ||
// to satisfy SEO scrolling measurements: | ||
var data = { | ||
cb: cb, | ||
capture: capture | ||
}; | ||
if (['touchstart', 'touchmove', 'wheel', 'mousewheel', 'scroll'].indexOf(event) !== -1) { | ||
if (capture === false) { | ||
capture = { | ||
passive: true | ||
}; | ||
} | ||
if (capture === true) { | ||
capture = { | ||
passive: true, | ||
capture: true | ||
}; | ||
} | ||
if (typeof capture === 'object') { | ||
capture.passive = true; | ||
} | ||
} // _domassistevents keeps track of events we registered | ||
// with 'domassist.on' so they can be deregistered by | ||
// 'domassist.off' without affecting events registered | ||
// by other libraries: | ||
if (!window._domassistevents) { | ||
@@ -64,3 +84,6 @@ window._domassistevents = {}; | ||
window._domassistevents["_" + event] = data; | ||
window._domassistevents["_" + event] = { | ||
cb: cb, | ||
capture: capture | ||
}; | ||
var el = find(selector); | ||
@@ -229,12 +252,9 @@ | ||
if (!window._domassistevents) { | ||
window._domassistevents = {}; | ||
} | ||
if (!window._domassistevents || !window._domassistevents["_" + event]) { | ||
return; | ||
} // only disable events that were registered with domassist.on, | ||
// don't de-register events that were registered by other libs: | ||
var data = window._domassistevents["_" + event]; | ||
if (!data) { | ||
return; | ||
} | ||
var el = find(selector); | ||
@@ -241,0 +261,0 @@ |
@@ -7,11 +7,9 @@ import find from './find'; | ||
} | ||
if (!window._domassistevents) { | ||
window._domassistevents = {}; | ||
if (!window._domassistevents || !window._domassistevents[`_${event}`]) { | ||
return; | ||
} | ||
// only disable events that were registered with domassist.on, | ||
// don't de-register events that were registered by other libs: | ||
const data = window._domassistevents[`_${event}`]; | ||
if (!data) { | ||
return; | ||
} | ||
const el = find(selector); | ||
@@ -18,0 +16,0 @@ if (el.length) { |
@@ -9,12 +9,28 @@ import find from './find'; | ||
const data = { | ||
cb, | ||
capture | ||
}; | ||
// scrolling events need the passive listener attached | ||
// to satisfy SEO scrolling measurements: | ||
if (['touchstart', 'touchmove', 'wheel', 'mousewheel', 'scroll'].indexOf(event) !== -1) { | ||
if (capture === false) { | ||
capture = { passive: true }; | ||
} | ||
if (capture === true) { | ||
capture = { passive: true, capture: true }; | ||
} | ||
if (typeof capture === 'object') { | ||
capture.passive = true; | ||
} | ||
} | ||
// _domassistevents keeps track of events we registered | ||
// with 'domassist.on' so they can be deregistered by | ||
// 'domassist.off' without affecting events registered | ||
// by other libraries: | ||
if (!window._domassistevents) { | ||
window._domassistevents = {}; | ||
} | ||
window._domassistevents[`_${event}`] = { | ||
cb, | ||
capture | ||
}; | ||
window._domassistevents[`_${event}`] = data; | ||
const el = find(selector); | ||
@@ -21,0 +37,0 @@ if (el.length) { |
{ | ||
"name": "domassist", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Various dom helpers", | ||
@@ -5,0 +5,0 @@ "main": "domassist.js", |
@@ -10,3 +10,5 @@ # domassist | ||
`npm install domassist` | ||
```sh | ||
npm install domassist | ||
``` | ||
@@ -13,0 +15,0 @@ ## Usage |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
56210
1584
453
1