client/polyfill: add NodeList.querySelectorAll

This commit is contained in:
rr- 2016-06-13 20:10:55 +02:00
parent 7116903438
commit 892c154b34
1 changed files with 13 additions and 0 deletions

View File

@ -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) {