UNPKG

tiny-element

Version:
9 lines (7 loc) 396 B
var slice = [].slice; module.exports = function (selector, multiple) { var ctx = this === window ? document : this; return (typeof selector == 'string') ? (multiple) ? slice.call(ctx.querySelectorAll(selector), 0) : ctx.querySelector(selector) : (selector instanceof Node || selector === window || !selector.length) ? (multiple ? [selector] : selector) : slice.call(selector, 0); };