Skip to content

fix: avoid script Array.from() for older browsers#11717

Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom
colinrotherham:scripts-array-from
Nov 23, 2023
Merged

fix: avoid script Array.from() for older browsers#11717
christian-bromann merged 1 commit intowebdriverio:mainfrom
colinrotherham:scripts-array-from

Conversation

@colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Nov 23, 2023

I'd missed another ES2015 feature in #11712 that causes element isDisplayed() errors in older browsers

This PR fixes #11716 which shows more info:

Proposed changes

Due to missing Array.from() support in Internet Explorer, we should change element.childNodes loops:

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

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

I've used npm link on this branch against our test suite and Internet Explorer 11 now works fully 🙌
https://app.saucelabs.com/tests/337440d31bba4b86bef79ad74120cd75?auth=df173806cff971e450b9c09008348705

Reviewers: @webdriverio/project-committers

@colinrotherham colinrotherham added the PR: Bug Fix 🐛 PRs that contain bug fixes label Nov 23, 2023
@colinrotherham
Copy link
Contributor Author

colinrotherham commented Nov 23, 2023

Going to run the tests again (one failure) but seems to happen on main too

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks a lot 👍

@christian-bromann
Copy link
Member

Going to run the tests again (one failure) but seems to happen on main too

Yes, we have some flakes in our e2e tests in working on improving on it.

@christian-bromann christian-bromann merged commit d9beb8c into webdriverio:main Nov 23, 2023
@colinrotherham
Copy link
Contributor Author

Thanks @christian-bromann was just running the checks again for my green tick 😆

@colinrotherham colinrotherham deleted the scripts-array-from branch November 23, 2023 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Array.from() errors in older browsers via isElementDisplayed()

2 participants