UNPKG

@wezom/zz-load

Version:

Lazy loader based on IntersectionObserver API

16 lines (15 loc) 547 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const isJQuery = (element) => !!(element && element.jquery); function default_1(element) { if (element instanceof Element) { return [element]; } else if (isJQuery(element)) { return element.toArray().filter((element) => element instanceof Element); } else { const nodeList = typeof element === 'string' ? document.querySelectorAll(element) : element; return Array.from(nodeList).filter((node) => node instanceof Element); } } exports.default = default_1;