client/polyfill: add NodeList.querySelectorAll
This commit is contained in:
parent
7116903438
commit
892c154b34
|
@ -16,6 +16,19 @@ NodeList.prototype.querySelector = function(...args) {
|
||||||
return null;
|
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
|
// non standard
|
||||||
Node.prototype.prependChild = function(child) {
|
Node.prototype.prependChild = function(child) {
|
||||||
if (this.firstChild) {
|
if (this.firstChild) {
|
||||||
|
|
Loading…
Reference in New Issue