Skip to content

Commit

Permalink
Add work-around for w3c/DOM-Parsing#48
Browse files Browse the repository at this point in the history
Fixes #86
  • Loading branch information
bwrrp committed Mar 22, 2019
1 parent 60aa1f1 commit f99c1b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dom-parsing/serializationAlgorithms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,10 @@ function serializeAttributes(
// value of attr's value attribute is the empty string, then throw an exception;
// namespace prefix declarations cannot be used to undeclare a namespace (use a
// default namespace declaration instead).
if (requireWellFormed && attr.value === '') {
// (we deviate from the spec here by only throwing for prefix declarations, the
// implementations of this in browsers and the spec text suggest that default
// namespace declarations should be allowed to reset the default namespace to null)
if (requireWellFormed && attr.prefix !== null && attr.value === '') {
throw new Error(
'Namespace prefix declarations cannot be used to undeclare a namespace ' +
'(use a default namespace declaration instead)'
Expand Down

0 comments on commit f99c1b4

Please sign in to comment.