Simplify DomHelper.getVisibleElements
Use a `filter` instead of a loop with an index.
This commit is contained in:
parent
c51a3270da
commit
fd1fee852c
1 changed files with 2 additions and 10 deletions
|
@ -22,16 +22,8 @@ class DomHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
static getVisibleElements(selector) {
|
static getVisibleElements(selector) {
|
||||||
let elements = document.querySelectorAll(selector);
|
const elements = document.querySelectorAll(selector);
|
||||||
let result = [];
|
return [...elements].filter((element) => this.isVisible(element));
|
||||||
|
|
||||||
for (let i = 0; i < elements.length; i++) {
|
|
||||||
if (this.isVisible(elements[i])) {
|
|
||||||
result.push(elements[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static hasPassiveEventListenerOption() {
|
static hasPassiveEventListenerOption() {
|
||||||
|
|
Loading…
Reference in a new issue