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: [#1629] Multiple fixes to DOM parsing #1666

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

capricorn86
Copy link
Owner

No description provided.

@capricorn86 capricorn86 linked an issue Jan 7, 2025 that may be closed by this pull request
@@ -187,8 +187,8 @@ describe('XMLParser', () => {

expect((<HTMLElement>result.children[0].children[0]).textContent).toBe('');
expect((<HTMLElement>result.children[0].children[1]).textContent).toBe('');
expect((<HTMLElement>result.children[0].children[0]).innerHTML).toBe('<b></b>');
expect((<HTMLElement>result.children[0].children[1]).innerHTML).toBe('<b></b>');
expect((<HTMLElement>result.children[0].children[0]).innerHTML).toBe('<b/>');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is correct as we are within an XMLDocument:

var domParser = new DOMParser();
var result = domParser.parseFromString(
				`<div>
					<script><b></b></script>
					<style><b></b></style>
				</div>`,
				'application/xml'
			);
console.log(result.children[0].children[0].innerHTML);

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.

Support for DOMPurify
2 participants