fix: guard check for ShadowRoot using 'ShadowRoot' in window (#11705)#11706
Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom Nov 20, 2023
Merged
Conversation
…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
|
|
Member
|
Congratulations on your first WebdriverIO contribution 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ShadowRootinelement instanceof window.ShadowRootisn’t callable and has noprototypeso it throws the following error (see MDN docs)This tightens the fix from 410ea50 added in:
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers