We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 744ec6e commit 74d7196Copy full SHA for 74d7196
src/core/dom.js
@@ -60,7 +60,7 @@ const toNodeArray = (nodes) => {
60
* @returns {Array} - The DOM nodes found.
61
*/
62
const querySelectorAllAndMe = (el, selector) => {
63
- if (!el) {
+ if (!el || !el.querySelectorAll) {
64
return [];
65
}
66
src/core/dom.test.js
@@ -174,6 +174,15 @@ describe("core.dom tests", () => {
174
175
done();
176
});
177
+
178
+ it("return empty list, if the element is not a real element.", (done) => {
179
+ const res = dom.querySelectorAllAndMe("text", ".selector");
180
+ expect(Array.isArray(res)).toBe(true);
181
+ expect(res.length).toBe(0);
182
183
+ done();
184
+ });
185
186
187
188
describe("wrap tests", () => {
0 commit comments