-
Notifications
You must be signed in to change notification settings - Fork 65
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
Update live-edit.ts DOM Text Interpreted As HTML #883
base: develop
Are you sure you want to change the base?
Conversation
Hii @engcom-Hotel Could you please Look into this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Shivam7-1,
Thanks for the contribution!
Please help us find the answers to the below questions:
- Where exactly will this change impact functionality? Please help us by providing the steps to reproduce the impact of this change.
- Here, we are using
stripHtml
onelement.innerHTML
, which strips all the HTML content. UsinginnerText
doesn’t make sense to us.
Please let us know if missed anything here.
Thanks
@magento run all tests |
Hii @engcom-Hotel Thank you for Reviewing and your feedback
I had updated the code to use |
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -33,8 +33,8 @@ function stripHtml(html: string) { | |||
* @param {Element} element | |||
*/ | |||
function handlePlaceholderClass(element: Element) { | |||
if (stripHtml(element.innerHTML).length === 0) { | |||
element.innerHTML = ""; | |||
if (stripHtml(element.textContent).length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the usage of stripHtml
here because we are using textContent
here which works same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Hii @engcom-Hotel Thanks For Reviewing Yes I had done this changes |
@magento run all tests |
@magento run Functional Tests EE, Functional Tests CE, Functional Tests B2B |
1 similar comment
@magento run Functional Tests EE, Functional Tests CE, Functional Tests B2B |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Shivam7-1,
Some functional tests are failing repeatedly, please check if failures are due to code changes.
Thanks
Hii @engcom-Hotel Thanks For Reviewing i don't think this failure is due to code i think there is problem with some Known issues related to just like some other PR? |
Description (*)
Here innerText can be used it will avoid the risk of HTML injection, as these properties automatically escape any HTML special characters in the provided text. This helps prevent cross-site scripting (XSS) vulnerabilities by treating the input as plain text rather than interpreted HTML.
Checklist