From 892c154b34e1ce89913d45f8ae09f938f0f4e885 Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 13 Jun 2016 20:10:55 +0200 Subject: [PATCH] client/polyfill: add NodeList.querySelectorAll --- client/js/util/polyfill.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/js/util/polyfill.js b/client/js/util/polyfill.js index 0bf68a8..1940a26 100644 --- a/client/js/util/polyfill.js +++ b/client/js/util/polyfill.js @@ -16,6 +16,19 @@ NodeList.prototype.querySelector = function(...args) { return null; }; +NodeList.prototype.querySelectorAll = function(...args) { + let result = []; + for (let node of this) { + if (node.nodeType === 3) { + continue; + } + for (let childNode of node.querySelectorAll(...args)) { + result.push(childNode); + } + } + return result; +}; + // non standard Node.prototype.prependChild = function(child) { if (this.firstChild) {