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

createContextualFragment() should do adopt node or some such #65

Open
annevk opened this issue Oct 7, 2020 · 1 comment
Open

createContextualFragment() should do adopt node or some such #65

annevk opened this issue Oct 7, 2020 · 1 comment

Comments

@annevk
Copy link
Member

annevk commented Oct 7, 2020

The HTML fragment parsing algorithm creates its own dummy document. Which means that

document.createRange().createContextualFragment(`<img src=x onerror=alert(1)>`)

should technically not alert as things are currently defined (images are only fetched in active documents). However, it does. In all browsers. And if you check the node document of the returned fragment it will match document, which is an active document.

@rniwa
Copy link

rniwa commented May 13, 2021

Yeah, we need to use the same document as that of Range object here. I just noticed that createContextualFragment also has code to get rid of html, head, & body elements. That is very strange.

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

No branches or pull requests

2 participants