Ox.$: allow for passing nodelist as argument

This commit is contained in:
rolux 2014-09-22 14:31:19 +02:00
parent c041263c79
commit 78c1b55d85

View file

@ -35,6 +35,7 @@ Ox.$ = Ox.element = function $(value) {
var elementData = {}, var elementData = {},
elements = Ox.isArray(value) ? value // array of elements elements = Ox.isArray(value) ? value // array of elements
: Ox.isNodeList(value) ? Ox.slice(value) // nodelist
: !Ox.isString(value) ? [value] // window, document or element : !Ox.isString(value) ? [value] // window, document or element
: value[0] == '<' ? [document.createElement(value.slice(1, -1))] : value[0] == '<' ? [document.createElement(value.slice(1, -1))]
: Ox.slice(document.querySelectorAll(value)), : Ox.slice(document.querySelectorAll(value)),