Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reprocessElementsAssociatedWithIframe throwing an DOMException error #2913

Conversation

mariyanbitsov-af
Copy link

@mariyanbitsov-af mariyanbitsov-af commented Jun 20, 2023

Purpose

This pr fixes a bug with the processing of elements associated with Iframe. When the iframe name contains special characters, the querySelector method throws an exception and removes all the elements on the page.

Approach

The fix try catches the querySelectorAll method, in order to prevent exceptions that will remove all elements on the page. This way the expected behaviour is preserved

References

DevExpress/testcafe#7807

Pre-Merge TODO

  • Write tests for your proposed changes
  • Make sure that existing tests do not fail

@AlexKamaev
Copy link
Contributor

Hello. Thank you for your contribution.
We believe that wrapping the problematic code in a try/catch block is not the best option in this case. We would like to fix the cause of the issue. First of all, please try to escape special characters in a css string. You can use the following function: https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape_static
Also, please do not add unnecessary changes like imports.
In addition, please add a test for the fixed behavior.

@AlexKamaev
Copy link
Contributor

I closed this PR since there has been no activity for a long time

@AlexKamaev AlexKamaev closed this Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants