Skip to content

Add PARSER_MEDIA_TYPE option to support strict XHTML documents#568

Merged
cure53 merged 1 commit intocure53:mainfrom
tosmolka:tosmolka/567
Sep 14, 2021
Merged

Add PARSER_MEDIA_TYPE option to support strict XHTML documents#568
cure53 merged 1 commit intocure53:mainfrom
tosmolka:tosmolka/567

Conversation

@tosmolka
Copy link
Copy Markdown
Contributor

This pull request implements feature #567 (Support strict XHTML documents)

Background & Context

DOMPurify assumes input is HTML and forces text/html media type when the input is parsed with DOMParser. We would like to have the ability to parse the input as XHTML with media type application/xhtml+xml. This will make DOMParser even more strict and for example allow only lowercase tag and attribute names.

Tasks

  • Added new option PARSER_MEDIA_TYPE
    • text/html (default, current behavior)
    • application/xhtml+xml (new behavior, DOMParser treats input as xhtml and tags/attributes are case sensitive)
  • Added test cases "Config-Flag tests: PARSER_MEDIA_TYPE"

@cure53
Copy link
Copy Markdown
Owner

cure53 commented Sep 14, 2021

This looks great, thank you very much! Running tests now...

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.

2 participants