Skip to content

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

Open

Description

@annevk

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.

Activity

  1. rniwa commented on May 13, 2021

    @rniwa

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions