Skip to content

fix: guard check for ShadowRoot using 'ShadowRoot' in window (#11705)#11706

Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom
colinrotherham:guard-shadowroot-ie11
Nov 20, 2023
Merged

fix: guard check for ShadowRoot using 'ShadowRoot' in window (#11705)#11706
christian-bromann merged 1 commit intowebdriverio:mainfrom
colinrotherham:guard-shadowroot-ie11

Conversation

@colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Nov 20, 2023

This PR appears to fix #11705

Although other issues affecting Firefox 55 and Internet Explorer 11 might still exist

Proposed changes

In older browsers the right-hand operand window.ShadowRoot in element instanceof window.ShadowRoot isn’t callable and has no prototype so it throws the following error (see MDN docs)

TypeError: invalid 'instanceof' operand window.ShadowRoot

This tightens the fix from 410ea50 added in:

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

Reviewers: @webdriverio/project-committers

…iverio#11705)

Fixes an issue in older browsers where the right-hand operand in `element instanceof window.ShadowRoot` isn’t callable and has no `prototype` so it throws the error:

```
TypeError: invalid 'instanceof' operand window.ShadowRoot
```

Confirmed to affect Firefox 55 and Internet Explorer 11 in webdriverio#11705

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/invalid_right_hand_side_instanceof_operand
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 20, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: colinrotherham / name: Colin Rotherham (55654b9)

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, LGTM 👍

@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label Nov 20, 2023
@christian-bromann christian-bromann merged commit 59d349c into webdriverio:main Nov 20, 2023
@christian-bromann
Copy link
Member

Congratulations on your first WebdriverIO contribution 🎉

@colinrotherham colinrotherham deleted the guard-shadowroot-ie11 branch November 20, 2023 22:42
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]: TypeError: invalid 'instanceof' operand window.ShadowRoot in Firefox 55 + IE11

2 participants