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

Move the DOMParser class to HTML #5190

Merged
merged 4 commits into from
Jan 28, 2020
Merged

Move the DOMParser class to HTML #5190

merged 4 commits into from
Jan 28, 2020

Conversation

domenic
Copy link
Member

@domenic domenic commented Jan 4, 2020

This moves the DOMParser class from https://w3c.github.io/DOM-Parsing/
into HTML, per various offline discussions. Along the way, it improves
the spec in several minor ways and a couple notable ways:

This also closes w3c/DOM-Parsing#51 and
w3c/DOM-Parsing#34 by adding explanatory
notes for points that confused people enough to file an issue.


(See WHATWG Working Mode: Changes for more details.)


/comms.html ( diff )
/dynamic-markup-insertion.html ( diff )
/imagebitmap-and-animations.html ( diff )
/index.html ( diff )
/infrastructure.html ( diff )
/scripting.html ( diff )
/system-state.html ( diff )
/timers-and-user-prompts.html ( diff )

This moves the DOMParser class from https://w3c.github.io/DOM-Parsing/
into HTML, per various offline discussions. Along the way, it improves
the spec in several minor ways and a couple notable ways:

* It precisely defines the URL of the resulting document, in a way that
  matches the majority of browsers. As such, this closes
  w3c/DOM-Parsing#46.
* It more clearly states how the parser error documents are created,
  namely that they also get their content type and URL set.
source Show resolved Hide resolved
source Show resolved Hide resolved
data-x="concept-document-content-type">content type</span> is <var>type</var> and <span
data-x="concept-document-URL">url</span> is this's <span>relevant global object</span>'s <span
data-x="concept-document-window">associated <code>Document</code></span>'s <span
data-x="concept-document-URL">URL</span>.</p></li>
Copy link
Member Author

Choose a reason for hiding this comment

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

This choice matches Chromium and WebKit. Gecko seems to use the relevant global object's API base URL, i.e. the relevant global object's associated Document's base URL.

Gecko's choice is more consistent with many other APIs in the spec. However, for an old API like this, I think we should just go with the majority.

source Show resolved Hide resolved
source Show resolved Hide resolved
@sideshowbarker
Copy link
Contributor

@whatwg/documentation after this is merged, the Specifications table in https://developer.mozilla.org/en-US/docs/Web/API/DOMParser will need to be updated (at least — maybe the body of the article should also get some updates based on the spec refinements…)

source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
@annevk
Copy link
Member

annevk commented Jan 13, 2020

Forgot to add, thanks for starting this!

@domenic
Copy link
Member Author

domenic commented Jan 22, 2020

Ready for another round of review!

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Thanks, happy with this either way to be clear.

source Show resolved Hide resolved
@domenic
Copy link
Member Author

domenic commented Jan 24, 2020

Would anyone be up for reviewing web-platform-tests/wpt#21041? Maybe we have to wait until the web platform tests repo gets un-broken so it gets re-opened?

domenic added a commit to w3c/DOM-Parsing that referenced this pull request Jan 26, 2020
@domenic domenic merged commit 4704a66 into master Jan 28, 2020
@domenic domenic deleted the absorb-domparser branch January 28, 2020 22:07
domenic added a commit to w3c/DOM-Parsing that referenced this pull request Jan 29, 2020
Follows whatwg/html#5190.

Co-Authored-By: Michael[tm] Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation
Development

Successfully merging this pull request may close these issues.

It should be noted that parseFromString can throw exceptions
3 participants