Skip to content

fix: avoid script syntax to support IE11 again (#11711)#11712

Merged
christian-bromann merged 3 commits intowebdriverio:mainfrom
colinrotherham:scripts-ie11
Nov 22, 2023
Merged

fix: avoid script syntax to support IE11 again (#11711)#11712
christian-bromann merged 3 commits intowebdriverio:mainfrom
colinrotherham:scripts-ie11

Conversation

@colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Nov 22, 2023

Proposed changes

Attempts to fix #11711 so WebdriverIO v8 works with IE11

Avoids the following in browser scripts:

  1. Arrow functions =>
  2. Destructuring assignment const { that } = this
  3. Restricting .contains() to HTMLElement type

For 3) I've changed document to document.body which supports .contains() in IE11

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

It might help to lower TypeScript "target": "es2022" for ./packages/webdriverio/src/scripts in future

Arrow functions can be downleveled automatically

Reviewers: @webdriverio/project-committers

@colinrotherham colinrotherham added the PR: Bug Fix 🐛 PRs that contain bug fixes label Nov 22, 2023
@colinrotherham colinrotherham changed the title fix: avoid script syntax unsupported by IE11 (#11711) fix: avoid script syntax to support IE11 again (#11711) Nov 22, 2023
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 changeset 👍

@christian-bromann
Copy link
Member

It might help to lower TypeScript "target": "es2022" for ./packages/webdriverio/src/scripts in future

Yeah, it seems like we start to have a need for a more sophisticated build system (e.g. via Vite) that can help us package different projects and files in them. That seems like a bigger effort though. Feel free to raise an issue about it and I can add some comments on where a better build system can help us.

@christian-bromann christian-bromann merged commit 0309878 into webdriverio:main Nov 22, 2023
@colinrotherham colinrotherham deleted the scripts-ie11 branch November 22, 2023 17:25
@colinrotherham
Copy link
Contributor Author

Feel free to raise an issue about it and I can add some comments on where a better build system can help us.

Done ✅

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]: Arrow functions and .contains() crash IE11 via isElementDisplayed()

2 participants