Comparing version 1.5.0 to 1.6.0
@@ -14,6 +14,10 @@ (function (exports) { | ||
function isWindow(obj) { | ||
return obj != null && obj === obj.window; | ||
} | ||
function find(selector) { | ||
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
if (selector instanceof HTMLElement) { | ||
if (selector instanceof HTMLElement || isWindow(selector)) { | ||
return [selector]; | ||
@@ -62,3 +66,5 @@ } else if (selector instanceof NodeList) { | ||
}); | ||
return; | ||
} | ||
var data = { | ||
@@ -185,2 +191,26 @@ cb: cb, | ||
var SCROLLABLE_CONTAINER = getScrollableContainer(); | ||
function getScrollableContainer() { | ||
if (SCROLLABLE_CONTAINER) { | ||
return SCROLLABLE_CONTAINER; | ||
} | ||
var documentElement = window.document.documentElement; | ||
var scrollableContainer = void 0; | ||
documentElement.scrollTop = 1; | ||
if (documentElement.scrollTop === 1) { | ||
documentElement.scrollTop = 0; | ||
scrollableContainer = documentElement; | ||
} else { | ||
scrollableContainer = document.body; | ||
} | ||
SCROLLABLE_CONTAINER = scrollableContainer; | ||
return scrollableContainer; | ||
} | ||
function show(el) { | ||
@@ -333,2 +363,3 @@ var savedDisplay = el.dataset._currentDisplay || 'block'; | ||
hover: hover, | ||
isWindow: isWindow, | ||
off: off, | ||
@@ -338,2 +369,3 @@ on: on, | ||
removeClass: removeClass, | ||
scrollableContainer: getScrollableContainer, | ||
show: show, | ||
@@ -358,2 +390,3 @@ matches: matches, | ||
exports.hover = hover; | ||
exports.isWindow = isWindow; | ||
exports.off = off; | ||
@@ -363,2 +396,3 @@ exports.on = on; | ||
exports.removeClass = removeClass; | ||
exports.scrollableContainer = getScrollableContainer; | ||
exports.show = show; | ||
@@ -365,0 +399,0 @@ exports.matches = matches; |
@@ -8,2 +8,3 @@ import addClass from './lib/addClass'; | ||
import hover from './lib/hover'; | ||
import isWindow from './lib/isWindow'; | ||
import off from './lib/off'; | ||
@@ -13,2 +14,3 @@ import on from './lib/on'; | ||
import removeClass from './lib/removeClass'; | ||
import scrollableContainer from './lib/scrollableContainer'; | ||
import show from './lib/show'; | ||
@@ -33,2 +35,3 @@ import matches from './lib/matches'; | ||
hover, | ||
isWindow, | ||
off, | ||
@@ -38,2 +41,3 @@ on, | ||
removeClass, | ||
scrollableContainer, | ||
show, | ||
@@ -40,0 +44,0 @@ matches, |
@@ -8,2 +8,3 @@ export { default as addClass } from './lib/addClass'; | ||
export { default as hover } from './lib/hover'; | ||
export { default as isWindow } from './lib/isWindow'; | ||
export { default as off } from './lib/off'; | ||
@@ -13,2 +14,3 @@ export { default as on } from './lib/on'; | ||
export { default as removeClass } from './lib/removeClass'; | ||
export { default as scrollableContainer } from './lib/scrollableContainer'; | ||
export { default as show } from './lib/show'; | ||
@@ -15,0 +17,0 @@ export { default as matches } from './lib/matches'; |
import findOne from './findOne'; | ||
import isWindow from './isWindow'; | ||
function find(selector, context = null) { | ||
if (selector instanceof HTMLElement) { | ||
if (selector instanceof HTMLElement || isWindow(selector)) { | ||
return [selector]; | ||
@@ -6,0 +7,0 @@ } else if (selector instanceof NodeList) { |
@@ -6,3 +6,5 @@ import find from './find'; | ||
selector.forEach((item) => on(item, event, cb, capture)); | ||
return; | ||
} | ||
const data = { | ||
@@ -9,0 +11,0 @@ cb, |
{ | ||
"name": "domassist", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Various dom helpers", | ||
@@ -5,0 +5,0 @@ "main": "dist/domassist.js", |
Sorry, the diff of this file is not supported yet
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
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
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
81565
41
735
1