Skip to content
This repository was archived by the owner on Feb 21, 2022. It is now read-only.

Commit c767253

Browse files
committed
fixed a bug in ZxQuery constructor when passing HTMLCollection or NodeList (also affecting .children() method)
1 parent b51529e commit c767253

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/_tmp
44
/_docs
55
/build/github_deploy_key
6+
test.html

src/js/helpers/ZxQuery.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ function ZxQuery(element) {
135135

136136
if (element instanceof ZxQuery)
137137
return element;
138-
else if (element instanceof HTMLCollection || element instanceof NodeList || Array.isArray(element))
138+
else if (element instanceof HTMLCollection || element instanceof NodeList) {
139+
var list = this._selection = [];
140+
z$.each(element, function (i,el) {
141+
list.push(el);
142+
});
143+
} else if (Array.isArray(element))
139144
this._selection = element;
140145
else if (element === window || element instanceof HTMLElement || element instanceof Node)
141146
this._selection = [element];

0 commit comments

Comments
 (0)