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) {
|
||||
let elements = document.querySelectorAll(selector);
|
||||
let result = [];
|
||||
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
if (this.isVisible(elements[i])) {
|
||||
result.push(elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
const elements = document.querySelectorAll(selector);
|
||||
return [...elements].filter((element) => this.isVisible(element));
|
||||
}
|
||||
|
||||
static hasPassiveEventListenerOption() {
|
||||
|
|
Loading…
Reference in a new issue