Skip to content

Commit

Permalink
fix: avoid script Array.from() for older browsers (#11716) (#11717)
Browse files Browse the repository at this point in the history
Internet Explorer (all versions) never supported `Array.from()`

See: https://caniuse.com/mdn-javascript_builtins_array_from
  • Loading branch information
colinrotherham authored Nov 23, 2023
1 parent 5fe7908 commit d9beb8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/webdriverio/src/scripts/isElementDisplayed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default function isElementDisplayed (element: Element): boolean {

// If the container's overflow is not hidden and it has zero size, consider the
// container to have non-zero dimensions if a child node has non-zero dimensions.
return Array.from(element.childNodes).some(function (childNode: Element) {
return [].some.call(element.childNodes, function (childNode: Element) {
if (childNode.nodeType === Node.TEXT_NODE) {
return true
}
Expand Down Expand Up @@ -172,7 +172,7 @@ export default function isElementDisplayed (element: Element): boolean {
}

// This element's subtree is hidden by overflow if all child subtrees are as well.
return Array.from(element.childNodes).every(function (childNode: Element) {
return [].every.call(element.childNodes, function (childNode: Element) {
// Returns true if the child node is overflowed or otherwise hidden.
// Base case: not an element, has zero size, scrolled out, or doesn't overflow container.
// Visibility of text nodes is controlled by parent
Expand Down

0 comments on commit d9beb8c

Please sign in to comment.