Skip to content

DOMParser: clarify XML error handling#9383

Merged
wbamberg merged 1 commit intomdn:mainfrom
danburzo:main
Oct 1, 2021
Merged

DOMParser: clarify XML error handling#9383
wbamberg merged 1 commit intomdn:mainfrom
danburzo:main

Conversation

@danburzo
Copy link
Copy Markdown
Contributor

Summary

Updated the DOMParser.parseFromString and Parsing and serializing XML pages with better error handling.

Motivation

According to the HTML standard, when encountering non-conforming input, the XML parser produces a <parsererror> node as the root of the resulting XMLDocument. However, in Safari and Chrome, this node is not always the root.

Supporting details

Related issues

Fixes #9380.

Metadata

  • Adds a new document
  • Rewrites (or significantly expands) a document
  • Fixes a typo, bug, or other error

@danburzo danburzo requested review from a team as code owners September 30, 2021 18:07
@danburzo danburzo requested review from wbamberg and removed request for a team September 30, 2021 18:07
@github-actions github-actions bot added Content:Learn Learning area docs Content:WebAPI Web API docs labels Sep 30, 2021
@github-actions
Copy link
Copy Markdown
Contributor

Preview URLs

Flaws

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/DOMParser/parseFromString
Title: DOMParser.parseFromString()
on GitHub
Flaw count: 1

  • macros:
    • /en-US/docs/Glossary/xhtml+xml does not exist

External URLs

URL: /en-US/docs/Web/Guide/Parsing_and_serializing_XML
Title: Parsing and serializing XML
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/DOMParser/parseFromString
Title: DOMParser.parseFromString()
on GitHub

No new external URLs

@danburzo
Copy link
Copy Markdown
Contributor Author

I would also take this chance to clarify that the DOMParser doesn't do any SVG-specific magic when using image/svg+xml MIME type, can I do it in this PR or shall I submit a separate one?

@wbamberg
Copy link
Copy Markdown
Collaborator

Thanks for this PR!

I would also take this chance to clarify that the DOMParser doesn't do any SVG-specific magic when using image/svg+xml MIME type, can I do it in this PR or shall I submit a separate one?

...and thanks for asking about this! I'd prefer a separate PR. I'll review this one today, so you're not left hanging :).

Copy link
Copy Markdown
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

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

👍 thanks @danburzo , this looks great to me!

@danburzo
Copy link
Copy Markdown
Contributor Author

danburzo commented Oct 1, 2021

Cool, thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Content:Learn Learning area docs Content:WebAPI Web API docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with "DOMParser.parseFromString()": does not throw error on invalid input

2 participants