From dea06d0caf71f9ac48a38f287549b5cb6711bef6 Mon Sep 17 00:00:00 2001
From: Ms2ger The IDL fragments in this specification must be interpreted as required for conforming IDL
fragments, as described in the Web IDL specification. [[!WEBIDL]]
@@ -87,7 +87,7 @@ Vendor-specific proprietary extensions to this specification are strongly discouraged. Authors
@@ -102,7 +102,7 @@ When vendor-neutral extensions to this specification are needed, either this specification can
be updated accordingly, or an extension specification can be written that overrides the
requirements in this specification. Such an extension specification becomes an
- applicable specification for the purposes of conformance requirements in this
+ applicable specification for the purposes of conformance requirements in this
specification.
The term context object means the object on which the API being discussed was
- called.
-
The following terms are understood to represent their respective namespaces in this
specification (and makes it easier to read):
@@ -1327,22 +1324,14 @@ The above may return At this point, the namespace for this node still needs to be serialized, but
- there's no This allows template content to round-trip , given the rules for
+ This allows template content to round-trip, given the rules for
parsing XHTML documents. If the require well-formed flag is set (its value is This map is local to each element. It is used to ensure there are no conflicting
- prefixes should a new namespace To copy a namespace prefix map map means to copy the map's
keys into a new empty namespace prefix map, and to copy each of the values in the
namespace prefix list associated with each keys' value into a new
- list which should be associated with the respective key in the new map.
+ list which is associated with the respective key in the new map.
To retrieve a preferred prefix string
preferred prefix from the namespace prefix map map given a namespace
- ns, the user agent should:
+ ns, the user agent must:
To check if a prefix string prefix is found in a
- namespace prefix map map given a namespace ns, the user agent should:
+ namespace prefix map map given a namespace ns, the user agent must:
To add a prefix string prefix to the namespace prefix map
- map given a namespace ns, the user agent should:
+ map given a namespace ns, the user agent must:
The above may return The above can return The following may serialize a different
+ The following can serialize a different
The steps in retrieve a preferred prefix string use the list to
track the most recently used (MRU) prefix associated with a given namespace, which
- will be the prefix at the end of the list. This list may contain duplicates of the
+ will be the prefix at the end of the list. This list can contain duplicates of the
same prefix value seen earlier (and that's OK). This specification depends on the Infra Standard. [[!INFRA]]
+
The IDL fragments in this specification must be interpreted as required for conforming IDL
fragments, as described in the Web IDL specification. [[!WEBIDL]]
From a08f75f1b66aaacfdfcccfb11b7db821175abdb4 Mon Sep 17 00:00:00 2001
From: Ms2ger The following terms are understood to represent their respective namespaces in this
- specification (and makes it easier to read):
-
- Per [[DOM4]], To produce an XML serialization of a Otherwise, run the following steps:
This map is local to each element. It is used to ensure there are no conflicting
@@ -447,7 +447,7 @@ The above step will update map with any found namespace prefix
definitions, add the found prefix definitions to the local prefixes map and
return a local default namespace value defined by a default namespace attribute if one
- exists. Otherwise it returns Candidate Recommendation Exit Criteria
Report.
-Candidate Recommendation Exit Criteria
propagated up to its caller.
Extensibility
Extensibility
Extensibility
- Dependencies
The HTML specification [[!HTML5]] defines the following terms used in this document:
-
The following terms used in this document are defined by [[DOM]]:
@@ -1429,12 +1399,6 @@ Dependencies
case-sensitive and
ASCII case-insensitive string comparisons;
a node's children,
- first child,
- next sibling and
- parent;
- the content type and
- encoding;
a HTML document;
- a local name;
a namespace concept;
- a node document;
- the append,
- insert and
- replace operations;
tree order;
- a range's start node;
- document URL;
- a XML document;
Dependencies
Dependencies
Dependencies
-
- The Web IDL [[WebIDL]] specification defines:
-
-
-
Extensibility
prefix attribute.
null if no namespace key ns exists
@@ -591,8 +591,8 @@ Extensibility
to ns, then:
prefix (or candidate prefix) availble; the following uses
- the default namespace declaration to define the namespace--optionally replacing an existing
+ there's no prefix (or candidate prefix) available; the following uses
+ the default namespace declaration to define the namespace—optionally replacing an existing
default declaration if present.
@@ -693,7 +693,7 @@
@@ -1113,7 +1113,7 @@ Extensibility
inherited ns, map, prefix index, and the
require well-formed flag.
- Extensibility
localName (as the prefix to
find) is found in the namespace prefix map given the namespace consisting
of the attr's value (the current namespace prefix
- definition was exactly defined previously--on an ancestor element not the current
+ definition was exactly defined previously—on an ancestor element not the current
element whose attributes are being processed).
@@ -969,7 +969,7 @@ Extensibility
then throw an exception; namespace prefix declarations cannot be used to undeclare a
namespace (use a default namespace declaration instead).
- prefix matches the string
+ prefix matches the string
"xmlns", then let candidate prefix be the string
"xmlns".
Extensibility
true), and
node's data contains characters that are not matched by the XML
Char production or contains "--" (two adjacent U+002D HYPHEN-MINUS
- characters) or that ends with a "-" (U+002D HYPHEN-MINUS) character, then
+ characters) or ends with a "-" (U+002D HYPHEN-MINUS) character, then
throw an exception; the serialization of this node's data
would not be well-formed.
@@ -1172,7 +1172,7 @@ Extensibility
DocumentFragment is as follows:
-
Extensibility
represented by the empty string).
prefix attribute need to be
+ prefixes if a new namespace prefix attribute needs to be
generated. It is also used to enable skipping of duplicate
prefix definitions when
writing an element's attributes: the map
@@ -816,11 +816,11 @@ Extensibility
Extensibility
Extensibility
From 4d9ae7d2b692f321ad1294a9aeb6c9a633cf6adc Mon Sep 17 00:00:00 2001
From: Ms2ger Extensibility
prefix is null and the
ignore namespace definition attribute flag is true (the
- Element's default namespace attribute should be skipped);
+ Element's default namespace attribute is to be skipped);
prefix is not null and either
From 553f3284f3b0b3ccc269ad687e7a3717d534678a Mon Sep 17 00:00:00 2001
From: Ms2ger
Extensibility
retrieving a preferred prefix string prefix from map given
namespace ns.
- null if no namespace key ns exists
+ null if no namespace key ns exists
in map.xmlns", then run the following
@@ -510,7 +510,7 @@ Extensibility
null (a namespace prefix is defined which maps to ns), then:
- prefix than the Element's existing
prefix if it already had one. However, the
retrieving a preferred prefix string algorithm already tried to match the existing
@@ -869,7 +869,7 @@ Extensibility
Candidate Recommendation Exit Criteria
Extensibility
-
-
-
http://www.w3.org/1999/xhtml
- http://www.w3.org/XML/1998/namespace
- http://www.w3.org/2000/xmlns/
- APIs for parsing and serializing DOM
From 196d2c76707082f57b19df9f3369370634b48f66 Mon Sep 17 00:00:00 2001
From: Ms2ger Extensibility
Attr objects do not inherit from Node, and
thus cannot be serialized by the XML serialization algorithm. An attempt to serialize an
- Attr object will result in an empty string.
+ Attr object will result in the empty string.
Node node given
a flag require well-formed, run the following steps:
@@ -393,7 +393,7 @@ Extensibility
Attr object
- Extensibility
<" (U+003C LESS-THAN SIGN).
- false.
@@ -1082,7 +1082,7 @@ Extensibility
-
+
+ Extensibility
"'" (U+0027 APOSTROPHE), then throw an exception; the serialization of this
node would not be a well-formed document type declaration.
- <!DOCTYPE" to markup.
From a2412966b1cfc46ca883b3f87777a811dff66aef Mon Sep 17 00:00:00 2001
From: Ms2ger Extensibility
require well-formed flag as input;
"" (U+0022 QUOTATION MARK).
-
- null (there exists a
- locally-defined default namespace declaration attribute), then let
- inherited ns get the value of local default namespace
- unless the local default namespace is the empty string in which case let
- it get null.
null (there exists a
+ locally-defined default namespace declaration attribute), then let
+ inherited ns get the value of local default namespace
+ unless the local default namespace is the empty string in which case let
+ it get null.
null, or
From a0a410001b30f74fc4d34f69f771d7e12647bf3c Mon Sep 17 00:00:00 2001
From: Ms2ger Extensibility
a flag require well-formed, run the following steps:
-
null.
+ null) to start.
+ (null) to start.
Extensibility
follows:
-
true),
+ localName attribute contains the character
":" (U+003A COLON) or does not match the XML Name production, then
throw an exception; the serialization of this node would not be a well-formed
@@ -418,17 +418,17 @@ Extensibility
false.
+ false.
+ false.
prefix strings as its keys, with corresponding namespaceURI
- Node values as the map's key values (in this map, the null namespace is
+ Node values as the map's key values (in this map, the null namespace is
represented by the empty string).
Extensibility
null.
null, then set
- ignore namespace definition attribute to true.
+ xml:" and the
@@ -485,7 +485,7 @@ The above can return null if no namespace key ns exists
+
The above can return null if no namespace key ns exists in map.
xmlns", then run the following
@@ -501,7 +501,7 @@ null (a namespace prefix is defined which maps to ns), then:
+ null (a namespace prefix is defined which maps to ns), then:
The following can serialize a different
prefix than the Element's existing
@@ -516,12 +516,12 @@
null (there exists
+ null (the context namespace is changed to the declared default, rather
+ null (the context namespace is changed to the declared default, rather
than this node's own namespace).
Any default namespace definitions or namespace prefixes that define the @@ -530,7 +530,7 @@
null, then:
+ By this step, there is no namespace or prefix mapping declaration in this node (or any parent node visited by this algorithm) that defines @@ -572,15 +572,15 @@
"" (U+0022 QUOTATION MARK).
- null (there exists a
+ null.
+ it get null.
- null, or
- local default namespace is not null and its value is not equal
+ At this point, the namespace for this node still needs to be serialized, but @@ -590,7 +590,7 @@
true.
+ true.
localName.
@@ -667,15 +667,15 @@ /" (U+002F SOLIDUS).
true.
+ and set the skip end tag flag to true.
/" (U+002F SOLIDUS) to markup
- and set the skip end tag flag to true.
+ and set the skip end tag flag to true.
>" (U+003E GREATER-THAN SIGN) to markup.
- true, then return the value of
+ This following algorithm will update the namespace prefix map with any found namespace
prefix definitions, add the found prefix definitions to the local prefixes map,
and return a local default namespace value defined by a default namespace attribute if one
- exists. Otherwise it returns null.
When recording the namespace information for an Element
element, given a namespace prefix map map and a
@@ -719,7 +719,7 @@
null.
+ attributes, in the order they are specified in the element's
@@ -739,12 +739,12 @@ null, then attr is a default
+ value and stop running these steps, returning to Main to visit
the next attribute.
- null and attr
+ xml" prefix.
null
+ having no namespace), then let namespace definition be null
instead.
null with the empty string if applicable.
+ key's value replacing the value of null with the empty string if applicable.
The empty string is a legitimate return value and is not converted to
- null.
A namespace prefix map is a map that associates namespaceURI and
namespace prefix lists, where namespaceURI values are the
- map's unique keys (which can include the null value representing no namespace), and
+ map's unique keys (which can include the null value representing no namespace), and
ordered lists of associated prefix values are the map's key values. The
namespace prefix map will be populated by previously seen namespaceURIs and all their
previously encountered prefix associations for a given node and its ancestors.
@@ -818,7 +818,7 @@
null value.
+ is no such key, then stop running these steps, and return the null value.
false.
+ is no such key, then stop running these steps, and return false.
true, otherwise return false.
+ true, otherwise return false.
To add a prefix string prefix to the namespace prefix map @@ -852,9 +852,9 @@
null.
+ is no such key, then let candidates list be null.
- null, then create a new list with
+ attributes, in the order they are specified in the element's
attribute list:
true), and the
+ namespaceURI attribute and
localName attribute, then throw an exception; the serialization of
@@ -905,9 +905,9 @@ namespaceURI value.
- null.
+ null, then run these sub-steps:
+ xml" and drops any related definitions as seen in the above condition.
- prefix is null and the
- ignore namespace definition attribute flag is true (the
+ prefix is null and the
+ ignore namespace definition attribute flag is true (the
Element's default namespace attribute is to be skipped);
- prefix is not null and either
+ prefix is not null and either
localName is
not a key contained in the local prefixes map, or
@@ -948,7 +948,7 @@ true), and
+ value attribute matches the
XMLNS namespace, then throw an exception; the serialization of this attribute would
produce invalid XML because the XMLNS namespace is reserved and cannot be applied
@@ -957,7 +957,7 @@ DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.
-true), and
+ 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).
@@ -993,13 +993,13 @@ " (U+0020 SPACE) to result.
- null, then append to result
+ :" (U+003A COLON).
- true), and this
+ localName attribute contains the character
":" (U+003A COLON) or does not match the XML Name production or equals
- "xmlns" and attribute namespace is null, then
+ "xmlns" and attribute namespace is null, then
throw an exception; the serialization of this attr would not be a
well-formed attribute.
@@ -1022,12 +1022,12 @@ true), and
+ null, then return the empty string.
+ If the require well-formed flag is set (its value is true), and this
+
If the require well-formed flag is set (its value is true), and this
node has no documentElement (the
- documentElement attribute's value is null), then
+ documentElement attribute's value is null), then
throw an exception; the serialization of this node would not be a well-formed
document.
@@ -1103,7 +1103,7 @@
If the require well-formed flag is set (its value is true), and
+
If the require well-formed flag is set (its value is true), and
node's data contains characters that are not matched by the XML
Char production or contains "--" (two adjacent U+002D HYPHEN-MINUS
characters) or ends with a "-" (U+002D HYPHEN-MINUS) character, then
@@ -1138,7 +1138,7 @@
true), and
+ data contains characters that are not matched by the XML
Char production, then throw an exception; the serialization of this
node's data would not be well-formed.
@@ -1183,12 +1183,12 @@ true and the node's
+ publicId attribute contains characters that are not matched by the XML
PubidChar production, then throw an exception; the serialization of this
node would not be a well-formed document type declaration.
- true and the node's
+ systemId attribute contains characters that are not matched by the XML
Char production or that contains both a """ (U+0022 QUOTATION MARK) and a
"'" (U+0027 APOSTROPHE), then throw an exception; the serialization of this
@@ -1272,13 +1272,13 @@ true), and
+ target contains a ":" (U+003A COLON)
character or is an ASCII case-insensitive match for the string "xml", then
throw an exception; the serialization of this node's
target would not be well-formed.
- true), and
+ data contains characters that are not matched by the XML
Char production or contains the string "?>" (U+003F QUESTION MARK,
U+003E GREATER-THAN SIGN), then throw an exception; the serialization of this
From 5c4ae48bf6b6b685071b0c87b6c931d748863d79 Mon Sep 17 00:00:00 2001
From: Ms2ger This following algorithm will update the namespace prefix map with any found namespace - prefix definitions, add the found prefix definitions to the local prefixes map, - and return a local default namespace value defined by a default namespace attribute if one + prefix definitions, add the found prefix definitions to the local prefixes map, + and return a local default namespace value defined by a default namespace attribute if one exists. Otherwise it returns null.
When recording the namespace information for an Element
element, given a namespace prefix map map and a
- local prefixes map (initially empty), the user agent must run the following
- steps:
+ local prefixes map (initially empty), run the following steps:
The empty string is a legitimate return value and is not converted to null.
+To copy a namespace prefix map map means to copy the map's keys into a new empty namespace prefix map, and to copy each of the values in the namespace prefix list associated with each keys' value into a new list which is associated with the respective key in the new map. +
To retrieve a preferred prefix string preferred prefix from the namespace prefix map map given a namespace ns, the user agent must: @@ -834,7 +837,9 @@
To check if a prefix string prefix is found in a namespace prefix map map given a namespace ns, the user agent must: @@ -846,7 +851,9 @@
To add a prefix string prefix to the namespace prefix map map given a namespace ns, the user agent must: @@ -862,10 +869,11 @@
The steps in retrieve a preferred prefix string use the list to - track the most recently used (MRU) prefix associated with a given namespace, which - will be the prefix at the end of the list. This list can contain duplicates of the - same prefix value seen earlier (and that's OK).
+ track the most recently used (MRU) prefix associated with a given namespace, which + will be the prefix at the end of the list. This list can contain duplicates of the + same prefix value seen earlier (and that's OK). +xml" to
- prefix map.
+ prefix map.
- 1. The generated namespace prefix index is used to generate a new unique
prefix value when no suitable existing namespace prefix is available to serialize a
node's namespaceURI (or the namespaceURI of one of
node's attributes). See the generate a prefix algorithm.
- InvalidStateError"
DOMException.
Each of the following algorithms for producing an XML serialization of a DOM node - take as input a node to serialize and the following arguments: -
The XML serialization algorithm - produces an XML serialization of an arbitrary DOM node - node based on the node's interface type. Each referenced algorithm is - to be passed the arguments as they were recieved by the caller and return their result to the - caller. Re-throw any exceptions. If node's interface is:
+The XML serialization algorithm, given + a {{Node}} |node:Node|, + a string |namespace:string|, + a [=namespace prefix map=] |prefix map:namespace prefix map|, + a generated namespace prefix index |prefix index:generated namespace prefix index|, + and + a require well-formed flag, + must run the following steps: -
Element
- If node's interface is:
-Document
- Comment
- Text
- DocumentFragment
- DocumentType
- ProcessingInstruction
- Attr object
- The algorithm for XML serializing an Element node, given + an {{Element}} |node:Element|, + a string |namespace:string|, + a [=namespace prefix map=] |prefix map:namespace prefix map|, + a generated namespace prefix index |prefix index:generated namespace prefix index|, + and + a require well-formed flag, + must run the following steps:
localName attribute contains the character
":" (U+003A COLON) or does not match the XML Name production, then
throw an exception; the serialization of this node would not be a well-formed
@@ -423,7 +435,7 @@ namespaceURI attribute.
@@ -491,7 +503,7 @@ xmlns", then run the following
steps:
prefix "xmlns"
will not legally round-trip in a conforming XML parser.
@@ -543,7 +555,7 @@ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
"" (U+0022 QUOTATION MARK).
="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
"" (U+0022 QUOTATION MARK).
localName matches any
@@ -682,17 +694,17 @@ localName matches the string "template", then this is a
template element. Append to markup the result of
XML serializing a DocumentFragment node given the template element's
- template contents (a DocumentFragment), providing
- inherited ns, map, prefix index, and the
- require well-formed flag.
+ template contents (a DocumentFragment),
+ inherited ns, map, prefix index, and the
+ require well-formed flag.
This allows template content to round-trip, given the rules for parsing XHTML documents.
If the require well-formed flag is set (its value is true), and this +
The algorithm for XML serializing a Document node, given + a {{Document}} |node:Document|, + a string |namespace:string|, + a [=namespace prefix map=] |prefix map:namespace prefix map|, + a generated namespace prefix index |prefix index:generated namespace prefix index|, + and + a require well-formed flag, + must run the following steps: + +
If the require well-formed flag is set (its value is true), and this
node has no documentElement (the
documentElement attribute's value is null), then
throw an exception; the serialization of this node would not be a well-formed
@@ -1094,8 +1114,9 @@
This will serialize any number of ProcessingInstruction and Comment nodes both before and after the Document's documentElement node, including @@ -1104,15 +1125,20 @@
The algorithm for XML serializing a Comment node, given + a {{Comment}} |node:Comment|, + and + a require well-formed flag, + must run the following steps: -
If the require well-formed flag is set (its value is true), and +
If the require well-formed flag is set (its value is true), and
node's data contains characters that are not matched by the XML
Char production or contains "--" (two adjacent U+002D HYPHEN-MINUS
characters) or ends with a "-" (U+002D HYPHEN-MINUS) character, then
@@ -1121,14 +1147,19 @@
Otherwise, return the concatenation of "<!--", node's
data, and "-->".
+
The algorithm for XML serializing a Text node, given + a {{Text}} |node:Text|, + and + a require well-formed flag, + must run the following steps:
data contains characters that are not matched by the XML
Char production, then throw an exception; the serialization of this
node's data would not be well-formed.
@@ -1165,39 +1201,52 @@ The algorithm for XML serializing a DocumentFragment node, given + a {{DocumentFragment}} |node:DocumentFragment|, + a string |namespace:string|, + a [=namespace prefix map=] |prefix map:namespace prefix map|, + a generated namespace prefix index |prefix index:generated namespace prefix index|, + and + a require well-formed flag, + must run the following steps:
The algorithm for XML serializing a DocumentType node, given + a {{DocumentType}} |node:DocumentType|, + and + a require well-formed flag, + must run the following steps:
publicId attribute contains characters that are not matched by the XML
PubidChar production, then throw an exception; the serialization of this
node would not be a well-formed document type declaration.
- systemId attribute contains characters that are not matched by the XML
Char production or that contains both a """ (U+0022 QUOTATION MARK) and a
"'" (U+0027 APOSTROPHE), then throw an exception; the serialization of this
@@ -1272,22 +1321,27 @@ The algorithm for XML serializing a ProcessingInstruction node, given + a {{ProcessingInstruction}} |node:ProcessingInstruction|, + and + a require well-formed flag, + must run the following steps:
target contains a ":" (U+003A COLON)
character or is an ASCII case-insensitive match for the string "xml", then
throw an exception; the serialization of this node's
target would not be well-formed.
- data contains characters that are not matched by the XML
Char production or contains the string "?>" (U+003F QUESTION MARK,
U+003E GREATER-THAN SIGN), then throw an exception; the serialization of this
@@ -1308,6 +1362,7 @@ PubidChar productions
The XML serialization of the attributes of an Element
element together with a namespace prefix map map, a
- generated namespace prefix index prefix index reference, a
- local prefixes map, a ignore namespace definition attribute flag, and a
- require well-formed flag, is the result of the following algorithm:
+ generated namespace prefix index prefix index reference,
+ an [=ordered map=] local prefixes map,
+ an ignore namespace definition attribute flag, and
+ a require well-formed flag, is the result of the following algorithm:
attributes, in the order they are specified in the element's
attribute list:
namespaceURI attribute and
localName attribute, then throw an exception; the serialization of
@@ -950,7 +952,7 @@ xml" and drops any related definitions as seen in the above condition.
prefix is null and the
- ignore namespace definition attribute flag is true (the
+ ignore namespace definition attribute flag is true (the
Element's default namespace attribute is to be skipped);
prefix is not null and either
@@ -964,13 +966,13 @@ localName (as the prefix to
- find) is found in the namespace prefix map given the namespace consisting
+ find) is found in map given the namespace consisting
of the attr's value (the current namespace prefix
definition was exactly defined previously—on an ancestor element not the current
element whose attributes are being processed).
- value attribute matches the
XMLNS namespace, then throw an exception; the serialization of this attribute would
produce invalid XML because the XMLNS namespace is reserved and cannot be applied
@@ -979,7 +981,7 @@ DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.
-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).
@@ -1006,7 +1008,7 @@ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
"" (U+0022 QUOTATION MARK).
:" (U+003A COLON).
- localName attribute contains the character
":" (U+003A COLON) or does not match the XML Name production or equals
"xmlns" and attribute namespace is null, then
@@ -1032,19 +1034,21 @@ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
value attribute and the require well-formed flag as input;
+ value attribute and the require well-formed flag as input;
"" (U+0022 QUOTATION MARK).
When serializing an attribute value given an attribute value and - require well-formed flag, the user agent must run the following steps: + require well-formed flag, run the following steps:
>" characters.
To generate a prefix given a namespace prefix map map, a string new namespace, and a reference to a generated namespace prefix index prefix index, the user agent must run the @@ -1091,6 +1092,7 @@
To produce an XML serialization of a Node node given
- a flag require well-formed, run the following steps:
+ a flag require well-formed, run the following steps:
InvalidStateError"
DOMException.
The XML serialization algorithm, given
From 1d36ad844decf7d833a5788603f3f7bbbf51178c Mon Sep 17 00:00:00 2001
From: Ms2ger Extensibility
<" (U+003C LESS-THAN SIGN).
- prefix strings as its keys, with corresponding namespaceURI
Node values as the map's key values (in this map, the null namespace is
represented by the empty string).
@@ -454,37 +454,37 @@ Extensibility
namespace prefix map that might be locally-defined (to the current Element) and
one that is not.
The above step will update map with any found namespace prefix - definitions, add the found prefix definitions to the local prefixes map and - return a local default namespace value defined by a default namespace attribute if one + definitions, add the found prefix definitions to the local prefixes map and + return a local default namespace value defined by a default namespace attribute if one exists. Otherwise it returns null.
-namespaceURI attribute.
- xml:" and the
+ qualified name the concatenation of the string "xml:" and the
value of node's localName.
- localName. The node's
prefix if it exists, is dropped.
- localName, let the value of inherited ns be ns,
- and append the value of qualified name to markup.
+ localName, let the value of inherited ns be ns,
+ and append the value of qualified name to markup.
All of the combinations where ns is not equal to
- inherited ns are handled above such that node will be serialized
+ inherited ns are handled above such that node will be serialized
preserving its original namespaceURI.
/" (U+002F SOLIDUS).
- and set the skip end tag flag to true.
+ and set the skip end tag flag to true.
/" (U+002F SOLIDUS) to markup
- and set the skip end tag flag to true.
+ and set the skip end tag flag to true.
>" (U+003E GREATER-THAN SIGN) to markup.
- template element. Append to markup the result of
XML serializing a DocumentFragment node given the template element's
template contents (a DocumentFragment),
- inherited ns, map, prefix index, and the
+ inherited ns, map, prefix index, and the
require well-formed flag.
This allows template content to round-trip, given the rules for @@ -705,14 +705,14 @@
</" (U+003C LESS-THAN SIGN, U+002F SOLIDUS);
- >" (U+003E GREATER-THAN SIGN).
prefix is not null and either
localName is
- not a key contained in the local prefixes map, or
+ not a key contained in the local prefixes map, or
localName is
- present in the local prefixes map but the value of the key does not match
+ present in the local prefixes map but the value of the key does not match
attr's value
To produce an XML serialization of a Node node given
- a flag require well-formed, run the following steps:
+ a boolean require well-formed, run the following steps:
InvalidStateError"
DOMException.
@@ -360,7 +360,7 @@ localName attribute contains the character
":" (U+003A COLON) or does not match the XML Name production, then
throw an exception; the serialization of this node would not be a well-formed
@@ -432,10 +432,9 @@ xmlns", then run the following
steps:
prefix "xmlns"
will not legally round-trip in a conforming XML parser.
@@ -580,8 +579,8 @@ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
- "" (U+0022 QUOTATION MARK).
localName.
@@ -629,8 +627,8 @@ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
- "" (U+0022 QUOTATION MARK).
localName matches any
@@ -681,11 +678,11 @@ /" (U+002F SOLIDUS).
/" (U+002F SOLIDUS) to markup
- and set the skip end tag flag to true.
+ and set skip end tag to true.
>" (U+003E GREATER-THAN SIGN) to markup.
@@ -697,16 +694,16 @@ template element. Append to markup the result of
XML serializing a DocumentFragment node given the template element's
template contents (a DocumentFragment),
- inherited ns, map, prefix index, and the
- require well-formed flag.
+ inherited ns, map, prefix index, and
+ require well-formed.
This allows template content to round-trip, given the rules for parsing XHTML documents.
attributes, in the order they are specified in the element's
attribute list:
namespaceURI attribute and
localName attribute, then throw an exception; the serialization of
@@ -953,8 +950,8 @@ xml" and drops any related definitions as seen in the above condition.
- prefix is null and the
- ignore namespace definition attribute flag is true (the
+ prefix is null and
+ ignore namespace definition attribute is true (the
Element's default namespace attribute is to be skipped);
prefix is not null and either
@@ -974,7 +971,7 @@ value attribute matches the
XMLNS namespace, then throw an exception; the serialization of this attribute would
produce invalid XML because the XMLNS namespace is reserved and cannot be applied
@@ -983,7 +980,7 @@ DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.
-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).
@@ -1010,7 +1007,7 @@ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
"" (U+0022 QUOTATION MARK).
:" (U+003A COLON).
- localName attribute contains the character
":" (U+003A COLON) or does not match the XML Name production or equals
"xmlns" and attribute namespace is null, then
@@ -1036,7 +1033,7 @@ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
value attribute and the require well-formed flag as input;
+ value attribute and require well-formed as input;
"" (U+0022 QUOTATION MARK).
When serializing an attribute value given an attribute value and - require well-formed flag, run the following steps: +
When serializing an attribute value given an attribute value and a + boolean require well-formed, run the following steps:
If the require well-formed flag is set (its value is true), and this +
If require well-formed is true, and this
node has no documentElement (the
documentElement attribute's value is null), then
throw an exception; the serialization of this node would not be a well-formed
@@ -1144,10 +1141,10 @@
The algorithm for XML serializing a Comment node, given a {{Comment}} |node:Comment|, and - a require well-formed flag, + a boolean require well-formed, must run the following steps: -
If the require well-formed flag is set (its value is true), and +
If require well-formed is true, and
node's data contains characters that are not matched by the XML
Char production or contains "--" (two adjacent U+002D HYPHEN-MINUS
characters) or ends with a "-" (U+002D HYPHEN-MINUS) character, then
@@ -1167,7 +1164,7 @@
The algorithm for XML serializing a CDATASection node, given a {{CDATASection}} |node:CDATASection|, and - a require well-formed flag, + a boolean require well-formed, must run the following steps:
The algorithm for XML serializing a Text node, given a {{Text}} |node:Text|, and - a require well-formed flag, + a boolean require well-formed, must run the following steps:
data contains characters that are not matched by the XML
Char production, then throw an exception; the serialization of this
node's data would not be well-formed.
@@ -1223,7 +1220,7 @@ The algorithm for XML serializing a DocumentType node, given a {{DocumentType}} |node:DocumentType|, and - a require well-formed flag, + a boolean require well-formed, must run the following steps:
publicId attribute contains characters that are not matched by the XML
PubidChar production, then throw an exception; the serialization of this
node would not be a well-formed document type declaration.
- systemId attribute contains characters that are not matched by the XML
Char production or that contains both a """ (U+0022 QUOTATION MARK) and a
"'" (U+0027 APOSTROPHE), then throw an exception; the serialization of this
@@ -1340,17 +1337,17 @@ The algorithm for XML serializing a ProcessingInstruction node, given a {{ProcessingInstruction}} |node:ProcessingInstruction|, and - a require well-formed flag, + a boolean require well-formed, must run the following steps:
target contains a ":" (U+003A COLON)
character or is an ASCII case-insensitive match for the string "xml", then
throw an exception; the serialization of this node's
target would not be well-formed.
- data contains characters that are not matched by the XML
Char production or contains the string "?>" (U+003F QUESTION MARK,
U+003E GREATER-THAN SIGN), then throw an exception; the serialization of this
From 96de61cf4069ce11a56cd47274f8d894881e4bc8 Mon Sep 17 00:00:00 2001
From: Ms2ger namespaceURI attribute.
xml:" and the
- value of node's localName.
+ qualified name the concatenation of the string "xml:" and
+ node's localName.
- localName. The node's
prefix if it exists, is dropped.
- prefix attribute.
The above can return null if no namespace key ns exists in map.
-xmlns", then run the following
+ xmlns", then run the following
steps:
prefix "xmlns"
will not legally round-trip in a conforming XML parser.
- localName, let the value of inherited ns be ns,
- and append the value of qualified name to markup.
+ ns. Append to qualified name node's
+ localName, let inherited ns be ns,
+ and append qualified name to markup.
All of the combinations where ns is not equal to inherited ns are handled above such that node will be serialized @@ -686,8 +686,8 @@
>" (U+003E GREATER-THAN SIGN) to markup.
- localName matches the string "template", then this is a
@@ -709,12 +709,12 @@ </" (U+003C LESS-THAN SIGN, U+002F SOLIDUS);
- >" (U+003E GREATER-THAN SIGN).
namespaceURI value.
- prefix.
localName.
- value.
The empty string is a legitimate return value and is not converted to null.
@@ -860,7 +860,7 @@localName attribute, and add it to the
localname set.
- namespaceURI value.
@@ -937,7 +937,7 @@ prefix value.
- value attribute matches the
+ attr's value attribute matches the
XMLNS namespace, then throw an exception; the serialization of this attribute would
produce invalid XML because the XMLNS namespace is reserved and cannot be applied
as an element's namespace via XML parsing.
@@ -981,7 +981,7 @@ value attribute is the empty string,
+ 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).
@@ -1002,7 +1002,7 @@ xmlns:";
- ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
@@ -1028,7 +1028,7 @@ &" with "&"
@@ -1129,7 +1129,7 @@ <![CDATA[",
node's data, and "]]>".
- data would not be well-formed.
- data.
+ data.
&" in markup by
"&".
@@ -1205,7 +1205,7 @@ >" in markup by
">".
- " (U+0020 SPACE) to markup.
- name
+ name
attribute to markup. For a node belonging to an HTML document, the
value will be all lowercase.
@@ -1279,7 +1279,7 @@ "" (U+0022 QUOTATION MARK);
- publicId attribute;
+ publicId attribute;
"" (U+0022 QUOTATION MARK).
"" (U+0022 QUOTATION MARK);
- systemId attribute;
+ systemId attribute;
"" (U+0022 QUOTATION MARK).
[" (U+005B LEFT SQUARE BRACKET);
- internalSubset attribute;
+ internalSubset attribute;
]" (U+005D RIGHT SQUARE BRACKET);
>" (U+003E GREATER-THAN SIGN) to markup.
- localName attribute contains the character
+ and this node's [=Element/local name=] contains the character
":" (U+003A COLON) or does not match the XML Name production, then
throw an exception; the serialization of this node would not be a well-formed
element.
@@ -474,10 +474,10 @@ xml:" and
- node's localName.
+ node's [=Element/local name=].
localName. The node's
+ [=Element/local name=]. The node's
prefix if it exists, is dropped.
:" (U+003A COLON), and node's
- localName. There exists on this node or the
+ candidate prefix, ":" (U+003A COLON), and node's
+ [=Element/local name=]. There exists on this node or the
node's ancestry a namespace prefix definition that defines the node's
namespace.
@@ -550,7 +550,7 @@ localName in node's
+ namespace prefix declaration of the same [=Attr/local name=] in node's
attribute list.
:" (U+003A COLON), and node's localName.
+ ":" (U+003A COLON), and node's [=Element/local name=].
localName.
+ localName, let inherited ns be ns,
+ [=Element/local name=], let inherited ns be ns,
and append qualified name to markup.
All of the combinations where ns is not equal to @@ -651,7 +650,7 @@
localName matches any
+ children is empty, and the node's [=Element/local name=] matches any
one of the following void elements:
"area",
"base",
@@ -690,7 +689,7 @@ localName matches the string "template", then this is a
+ [=Element/local name=] matches the string "template", then this is a
template element. Append to markup the result of
XML serializing a DocumentFragment node given the template element's
template contents (a DocumentFragment),
@@ -759,8 +758,7 @@ localName.
+ value.
@@ -904,10 +902,10 @@ namespaceURI and localName pairs, and is populated as
+ namespaceURI and [=Attr/local name=] pairs, and is populated as
each attr is processed. This set is used to [optionally] enforce
the well-formed constraint that an element cannot have two attributes with the same
- namespaceURI and localName. This can occur when two
+ namespaceURI and [=Attr/local name=]. This can occur when two
otherwise identical attributes on the same element differ only by their prefix values.
namespaceURI attribute and
- localName attribute, then throw an exception; the serialization of
+ [=Attr/local name=], then throw an exception; the serialization of
this attr would fail to produce a well-formed element serialization.
namespaceURI
- attribute and localName attribute, and add it to the
+ attribute and [=Attr/local name=], and add it to the
localname set.
prefix is not null and either
localName is
+ localName is
+ value
localName (as the prefix to
+ [=Attr/local name=] (as the prefix to
find) is found in map given the namespace consisting
of the attr's value (the current namespace prefix
definition was exactly defined previously—on an ancestor element not the current
@@ -1020,7 +1018,7 @@ :" (U+003A COLON).
localName attribute contains the character
+ attr's [=Attr/local name=] contains the character
":" (U+003A COLON) or does not match the XML Name production or equals
"xmlns" and attribute namespace is null, then
throw an exception; the serialization of this attr would not be a
@@ -1028,7 +1026,7 @@ localName;
+ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
@@ -1412,7 +1410,6 @@ HTMLScriptElement Node's
- namespace in order to preserve the identity of the
+ [=Element/namespace=] in order to preserve the identity of the
script element, and to allow the serialized string to
round-trip through an XML parser. Assuming that root
is in a variable named root:
@@ -301,10 +301,10 @@ namespaceURI is preserved. In some cases this means that an existing
- prefix, prefix declaration attribute or default namespace declaration attribute
+ that their namespace is preserved. In some cases this means that an existing
+ prefix, prefix declaration attribute or default namespace declaration attribute
might be dropped, substituted or changed. An HTML serialization does not attempt to
- preserve the namespaceURI.
+ preserve the namespace.
1. The generated namespace prefix index is used to generate a new unique
prefix value when no suitable existing namespace prefix is available to serialize a
- node's namespaceURI (or the namespaceURI of one of
+ node's [=Element/namespace=] (or the [=Attr/namespace=] of one of
node's attributes). See the generate a prefix algorithm.
@@ -439,19 +439,16 @@ prefix strings as its keys, with corresponding namespaceURI
- Node values as the map's key values (in this map, the null namespace is
+ This map is local to each element. It is used to ensure there are no conflicting
- prefixes if a new namespace prefix attribute needs to be
- generated. It is also used to enable skipping of duplicate
- prefix definitions when
+ prefixes if a new namespace prefix needs to be generated.
+ It is also used to enable skipping of duplicate prefix definitions when
writing an element's attributes: the map
- allows the algorithm to distinguish between a prefix in the
- namespace prefix map that might be locally-defined (to the current Element) and
- one that is not.
namespaceURI attribute.
+ prefix if it exists, is dropped.
+ [=Element/namespace prefix=] if it exists, is dropped.prefix attribute.
+ prefix "xmlns"
+ Element with [=Element/namespace prefix=] "xmlns"
will not legally round-trip in a conforming XML parser.
The following can serialize a different
- prefix than the Element's existing
- prefix if it already had one. However, the
+
The following can serialize a different [=Element/namespace prefix=] than the + Element's existing [=Element/namespace prefix=] if it already had one. However, the retrieving a preferred prefix string algorithm already tried to match the existing prefix if possible.
@@ -527,7 +521,7 @@:" (U+003A COLON), and node's
[=Element/local name=]. There exists on this node or the
node's ancestry a namespace prefix definition that defines the node's
- namespace.
+ [=Element/namespace=].Any default namespace definitions or namespace prefixes that define the XML namespace are omitted when serializing this node's attributes.
@@ -597,9 +591,9 @@At this point, the namespace for this node still needs to be serialized, but
- there's no prefix (or candidate prefix) available; the following uses
- the default namespace declaration to define the namespace—optionally replacing an existing
- default declaration if present.
The new default namespace will be used in the serialization to define this - node's namespace and act as the context namespace for its + node's [=Element/namespace=] and act as the context namespace for its children.
All of the combinations where ns is not equal to
inherited ns are handled above such that node will be serialized
- preserving its original namespaceURI.
namespaceURI value.
+ prefix.
+ A namespace prefix map is a map that associates namespaceURI and
- namespace prefix lists, where namespaceURI values are the
+
A namespace prefix map is a map that associates namespace and
+ namespace prefix lists, where namespace values are the
map's unique keys (which can include the null value representing no namespace), and
- ordered lists of associated prefix values are the map's key values. The
- namespace prefix map will be populated by previously seen namespaceURIs and all their
+ ordered lists of associated prefix values are the map's key values. The
+ namespace prefix map will be populated by previously seen namespaces and all their
previously encountered prefix associations for a given node and its ancestors.
-
Note: the last seen prefix for a given
- namespaceURI is at the end of its respective list. The list is searched to
+
Note: the last seen prefix for a given
+ namespace is at the end of its respective list. The list is searched to
find potentially matching prefixes, and if no matches are found for the given
- namespaceURI, then the last prefix in the list is used. See
+ namespace, then the last prefix in the list is used. See
copy a namespace prefix map and retrieve a preferred prefix string for additional
details.
namespaceURI and [=Attr/local name=] pairs, and is populated as
+ [=Attr/namespace=] and [=Attr/local name=] pairs, and is populated as
each attr is processed. This set is used to [optionally] enforce
the well-formed constraint that an element cannot have two attributes with the same
- namespaceURI and [=Attr/local name=]. This can occur when two
+ [=Attr/namespace=] and [=Attr/local name=]. This can occur when two
otherwise identical attributes on the same element differ only by their prefix values.
namespaceURI attribute and
+ of attr's [=Attr/namespace=] and
[=Attr/local name=], then throw an exception; the serialization of
this attr would fail to produce a well-formed element serialization.
- namespaceURI
- attribute and [=Attr/local name=], and add it to the
- localname set.
+ namespaceURI value.
+ prefix value.
+ [=Attr/namespace prefix=].
xml" and drops any related definitions as seen in the above condition.
- prefix is null and
+ prefix is not null and either
+ value
value (the current namespace prefix
definition was exactly defined previously—on an ancestor element not the current
@@ -983,7 +972,7 @@ prefix matches the string
+ xmlns", then let candidate prefix be the string
"xmlns".
If require well-formed is true, and this
- node has no documentElement (the
- documentElement attribute's value is null), then
- throw an exception; the serialization of this node would not be a well-formed
- document.
+
If require well-formed is true, and node's [=document element=] is + null, then throw an exception; the serialization of this node would not be a + well-formed document.
Otherwise, run the following steps:
This will serialize any number of ProcessingInstruction and Comment - nodes both before and after the Document's documentElement node, including + nodes both before and after the [=document element=], including at most one DocumentType node. (Text nodes are not allowed as children of the Document.)
@@ -1402,8 +1400,6 @@This will serialize any number of ProcessingInstruction and Comment nodes both before and after the [=document element=], including - at most one DocumentType node. (Text nodes are not allowed as children of the + at most one {{DocumentType}} node. (Text nodes are not allowed as children of the Document.)
publicId attribute contains characters that are not matched by the XML
- PubidChar production, then throw an exception; the serialization of this
- node would not be a well-formed document type declaration.
+ systemId attribute contains characters that are not matched by the XML
- Char production or that contains both a """ (U+0022 QUOTATION MARK) and a
- "'" (U+0027 APOSTROPHE), then throw an exception; the serialization of this
- node would not be a well-formed document type declaration.
+ "" (U+0022 QUOTATION MARK) and a "'" (U+0027 APOSTROPHE),
+ then throw an exception; the serialization of this node would not be a
+ well-formed document type declaration.
" (U+0020 SPACE) to markup.
- name
- attribute to markup. For a node belonging to an HTML document, the
- value will be all lowercase.
+ publicId is not the empty string then append
+ " (U+0020 SPACE);
@@ -1264,13 +1263,13 @@ "" (U+0022 QUOTATION MARK);
- publicId attribute;
+ "" (U+0022 QUOTATION MARK).
systemId is not the empty string and the
- node's publicId is set to the empty string, then append the
+ " (U+0020 SPACE);
@@ -1278,14 +1277,14 @@ SYSTEM".
systemId is not the empty string then append
+ " (U+0020 SPACE);
"" (U+0022 QUOTATION MARK);
- systemId attribute;
+ "" (U+0022 QUOTATION MARK).
This will serialize any number of ProcessingInstruction and Comment +
This will serialize any number of {{ProcessingInstruction}} and Comment nodes both before and after the [=document element=], including at most one {{DocumentType}} node. (Text nodes are not allowed as children of the Document.)
@@ -1325,27 +1325,27 @@target contains a ":" (U+003A COLON)
+ :" (U+003A COLON)
character or is an ASCII case-insensitive match for the string "xml", then
throw an exception; the serialization of this node's
- target would not be well-formed.
+ [=ProcessingInstruction/target=] would not be well-formed.
- data contains characters that are not matched by the XML
+ ?>" (U+003F QUESTION MARK,
U+003E GREATER-THAN SIGN), then throw an exception; the serialization of this
- node's data would not be well-formed.
+ node's [=CharacterData/data=] would not be well-formed.
<?" (U+003C LESS-THAN SIGN, U+003F QUESTION MARK);
- target;
+ " (U+0020 SPACE);
- data;
+ ?>" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN).
value and stop running these steps, returning to Main to visit
+ [=Attr/value=] and stop running these steps, returning to Main to visit
the next attribute.
value.
+ value is the XML namespace;
+ The XML namespace cannot be redeclared and survive
round-tripping (unless it defines the prefix "xml"). To avoid this
@@ -947,19 +946,18 @@
value
+ value (the current namespace prefix
+ of the attr's [=Attr/value=] (the current namespace prefix
definition was exactly defined previously—on an ancestor element not the current
element whose attributes are being processed).
- value attribute matches the
+ DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.
-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).
+ xmlns", then let candidate prefix be the string
@@ -1020,7 +1017,7 @@ ="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
value attribute and require well-formed as input;
+ [=Attr/value=] and require well-formed as input;
"" (U+0022 QUOTATION MARK).
If require well-formed is true, and
- node's data contains characters that are not matched by the XML
- Char production or contains "--" (two adjacent U+002D HYPHEN-MINUS
- characters) or ends with a "-" (U+002D HYPHEN-MINUS) character, then
- throw an exception; the serialization of this node's data
- would not be well-formed.
+
If require well-formed is true, and node's [=CharacterData/data=]
+ contains characters that are not matched by the XML Char production or contains
+ "--" (two adjacent U+002D HYPHEN-MINUS characters) or ends with a
+ "-" (U+002D HYPHEN-MINUS) character, then throw an exception; the
+ serialization of this node's [=CharacterData/data=] would not be well-formed.
Otherwise, return the concatenation of "<!--", node's
- data, and "-->".
+ [=CharacterData/data=], and "-->".
<![CDATA[",
- node's data, and "]]>".
+ node's [=CharacterData/data=], and "]]>".
data contains characters that are not matched by the XML
- Char production, then throw an exception; the serialization of this
- node's data would not be well-formed.
+ data.
+ &" in markup by
"&".
@@ -1392,7 +1391,6 @@ InvalidStateError"
- DOMException.
+ then catch that exception and throw an {{"InvalidStateError"}} {{DOMException}}.
The following conditional steps find namespace prefixes. Only attributes
in the XMLNS namespace are considered (e.g., attributes made to look like namespace
- declarations via setAttribute("xmlns:pretend-prefix",
- "pretend-namespace") are not included).
1. The generated namespace prefix index is used to generate a new unique
prefix value when no suitable existing namespace prefix is available to serialize a
- node's [=Element/namespace=] (or the [=Attr/namespace=] of one of
- node's attributes). See the generate a prefix algorithm.
-
+ node's [=Element/namespace=] (or the [=Attr/namespace=] of one of the
+ attributes in node's [=Element/attribute list=]).
+ See the generate a prefix algorithm.
Any default namespace definitions or namespace prefixes that define the - XML namespace are omitted when serializing this node's attributes.
+ XML namespace are omitted when serializing attributes in this + node's [=Element/attribute list=].attributes, in the order they are specified in the element's
- attribute list:
+ The following conditional steps find namespace prefixes. Only attributes - in the XMLNS namespace are considered (e.g., attributes made to look like namespace - declarations via {{Element/setAttribute(qualifiedName, - value)|setAttribute("xmlns:pretend-prefix", "pretend-namespace")}} are not included).
+The following conditional steps find namespace prefixes. Only + attributes in the XMLNS namespace are considered (e.g., + attributes made to look like namespace declarations via + {{Element/setAttribute(qualifiedName, value)|setAttribute("xmlns:pretend-prefix", + "pretend-namespace")}} are not included).
attributes, in the order they are specified in the element's
- attribute list:
+ This allows template content to round-trip, given the rules for parsing XHTML documents.
-Otherwise, [=set/for each=] child of node's [=tree/children=]: +
[=set/For each=] child of node's [=tree/children=]: +
This will serialize any number of {{ProcessingInstruction}} and Comment - nodes both before and after the [=document element=], including - at most one {{DocumentType}} node. (Text nodes are not allowed as children of the - Document.)
+This will serialize any number of {{ProcessingInstruction}} and Comment + nodes both before and after the [=document element=], including + at most one {{DocumentType}} node. (Text nodes are not allowed as children of the + Document.)
[=set/For each=] child of node's [=tree/children=]: +
template", then this is a
- template element. Append to markup the result of
- XML serializing a DocumentFragment node given the template element's
- template contents (a DocumentFragment),
+ [=Element/local name=] is "template" (this is a [^template^] element), append to
+ markup the result of XML serializing a DocumentFragment node given
+ node's template contents (a DocumentFragment),
inherited ns, map, prefix index, and
require well-formed.
@@ -1380,8 +1379,6 @@ Otherwise, the algorithm for producing an XML serialization is designed to produce a serialization that is compatible with the HTML parser. For example, elements in the - HTML namespace that contain no child nodes are serialized with an explicit begin and end - tag rather than using the empty-element tag syntax. + HTML namespace that contain no [=tree/children=] are serialized with an explicit begin and + end tag rather than using the empty-element tag syntax.
Per [[DOM4]], Attr objects do not inherit from Node, and
thus cannot be serialized by the XML serialization algorithm. An attempt to serialize an
@@ -604,7 +604,7 @@
The new default namespace will be used in the serialization to define this node's [=Element/namespace=] and act as the context namespace for its - children.
+ [=tree/children=].area",
"base",
@@ -673,8 +673,8 @@ /" (U+002F SOLIDUS) to markup
+ /" (U+002F SOLIDUS) to markup
and set skip end tag to true.
>" (U+003E GREATER-THAN SIGN) to markup.
@@ -1392,7 +1392,6 @@ Unless otherwise stated, string comparisons are done in a case-sensitive manner. -
If an algorithm calls into another algorithm, any exception that is thrown by the latter (unless it is explicitly caught), must cause the former to terminate, and the exception to be propagated up to its caller. @@ -1389,9 +1387,6 @@
A document object model (DOM) is an in-memory representation of various types of Nodes - where each Node is connected in a tree. The [[HTML5]] and [[DOM4]] specifications describe - DOM and its Nodes is greater detail. +
A document object model (DOM) is an in-memory representation of various types of {{Node}}s + where each {{Node}} is connected in a tree. The [[HTML5]] and [[DOM4]] specifications describe + DOM and its {{Node}}s is greater detail.
Parsing is the term used for converting a string representation of a DOM into an actual DOM, and Serializing is the term used to transform a DOM back into a string. This specification concerns itself with defining various APIs for both parsing and serializing a DOM. -
HTMLDivElement (nodeName: "div")
@@ -134,7 +134,7 @@ Extensibility
And the HTMLDivElement node is stored in a variable myDiv,
then to serialize myDiv's children simply get (read) the
- Element's innerHTML property (this triggers the serialization):
+ {{Element.innerHTML}} property (this triggers the serialization):
var serializedChildren = myDiv.innerHTML;
@@ -143,7 +143,7 @@ Extensibility
To parse new children for myDiv from a string (replacing its existing
- children), simply set the innerHTML property (this triggers
+ children), simply set the {{Element.innerHTML}} property (this triggers
parsing of the assigned string):
@@ -160,10 +160,10 @@Extensibility
Round-tripping a DOM means to serialize and then immediately parse the serialized string back into a DOM. Ideally, this process does not result in any data loss with respect to the - identity and attributes of the Node in the DOM. + identity and attributes of the {{Node}} in the DOM. Round-tripping is especially tricky for an XML serialization, which must be concerned with - preserving the Node's namespace identity in the serialization (wereas namespaces are + preserving the {{Node}}'s namespace identity in the serialization (wereas namespaces are ignored in HTML).
Consider the XML serialization of the following in-memory DOM: @@ -174,9 +174,8 @@Extensibility
┃ ┗━ Text (data: "alert('hello world')") - An XML serialization must include theHTMLScriptElementNode's - [=Element/namespace=] in order to preserve the identity of the -scriptelement, and to allow the serialized string to + An XML serialization must include the {{HTMLScriptElement}}'s [=Element/namespace=] in order to + preserve the identity of thescriptelement, and to allow the serialized string to round-trip through an XML parser. Assuming thatrootis in a variable namedroot: @@ -191,7 +190,7 @@Extensibility
APIs for parsing and serializing DOM
-The
+DOMParserinterface- The {{DOMParser}} interface
@@ -202,16 +201,16 @@Extensibility
-The definition of
+DOMParserhas moved to the HTML Standard.The definition of {{DOMParser}} has moved to the HTML Standard.
- The
+XMLSerializerinterface@@ -219,31 +218,31 @@ The {{XMLSerializer}} interface
-The definition of
+XMLSerializerhas moved to the HTML Standard.The definition of {{XMLSerializer}} has moved to the HTML Standard.
Extensibility
-The definition of
+InnerHTMLhas moved to the HTML Standard.The definition of {{Element.innerHTML}} has moved to the HTML Standard.
Extensions to the
+Elementinterface- Extensions to the {{Element}} interface
-The definition of
+outerHTMLhas moved to the HTML Standard.The definition of {{Element.outerHTML}} has moved to the HTML Standard.
-The definition of
+insertAdjacentHTMLhas moved to the HTML Standard.The definition of {{Element.insertAdjacentHTML}} has moved to the HTML Standard.
@@ -291,20 +290,20 @@ Extensions to the
+Rangeinterface@@ -283,7 +282,7 @@ Extensions to the {{Range}} interface
-The definition of
+createContextualFragmenthas moved to the HTML Standard.The definition of {{Range.createContextualFragment()}} has moved to the HTML Standard.
Extensibility
-The definition of
+fragment parsing algorithmhas moved to the HTML Standard.The definition of fragment parsing algorithm has moved to the HTML Standard.
Extensibility
-The definition of
+fragment serializing algorithmhas moved to the HTML Standard.The definition of fragment serializing algorithm has moved to the HTML Standard.
XML Serialization
An XML serialization differs from an HTML serialization in the following ways:
-
@@ -314,20 +313,20 @@- Elements and attributes will always be serialized such +
- {{Element}}s and attributes will always be serialized such that their namespace is preserved. In some cases this means that an existing prefix, prefix declaration attribute or default namespace declaration attribute might be dropped, substituted or changed. An HTML serialization does not attempt to preserve the namespace. -
- Elements not in the HTML namespace containing no [=tree/children=], are +
- {{Element}}s not in the HTML namespace containing no [=tree/children=], are serialized using the empty-element tag syntax (i.e., according to the XML EmptyElemTag production).
Extensibility
HTML namespace that contain no [=tree/children=] are serialized with an explicit begin and end tag rather than using the empty-element tag syntax. -Per [[DOM4]],
Attrobjects do not inherit from Node, and +Per [[DOM4]], {{Attr}} objects do not inherit from {{Node}}, and thus cannot be serialized by the XML serialization algorithm. An attempt to serialize an - Attr object will result in the empty string. + {{Attr}} object will result in the empty string.
-To produce an XML serialization of a
Nodenode given +To produce an XML serialization of a {{Node}} node given a boolean require well-formed, run the following steps:
- Let namespace be a context namespace with value null. The context namespace tracks the XML serialization algorithm's current default - namespace. The context namespace is changed when either an Element Node has + namespace. The context namespace is changed when either an {{Element}} has a default namespace declaration, or the algorithm generates a default namespace declaration for - the Element Node to match its own namespace. The algorithm assumes no namespace + the {{Element}} to match its own namespace. The algorithm assumes no namespace (null) to start.
- Let prefix map be a new namespace prefix map. @@ -445,7 +444,7 @@
Extensibility
It is also used to enable skipping of duplicate prefix definitions when writing an element's attributes: the map allows the algorithm to distinguish between a prefix in the namespace prefix map that - might be locally-defined (to the current Element) and one that is not. + might be locally-defined (to the current {{Element}}) and one that is not.- Let local default namespace be the result of recording the namespace information for node given map and @@ -497,7 +496,7 @@
Extensibility
steps:
- If require well-formed is true, then throw an error. An - Element with [=Element/namespace prefix=] "
xmlns" + {{Element}} with [=Element/namespace prefix=] "xmlns" will not legally round-trip in a conforming XML parser.- Let candidate prefix be prefix. @@ -509,7 +508,7 @@
Extensibility
null (a namespace prefix is defined which maps to ns), then:The following can serialize a different [=Element/namespace prefix=] than the - Element's existing [=Element/namespace prefix=] if it already had one. However, the + {{Element}}'s existing [=Element/namespace prefix=] if it already had one. However, the retrieving a preferred prefix string algorithm already tried to match the existing prefix if possible.
@@ -538,7 +537,7 @@Extensibility
- Otherwise, if prefix is not null, then:
By this step, there is no namespace or prefix mapping declaration in this - node (or any parent node visited by this algorithm) that defines + node (or any parent {{Node}} visited by this algorithm) that defines prefix otherwise the step labelled Found a suitable namespace prefix would have been followed. The sub-steps that follow will create a new namespace prefix declaration for prefix and ensure that prefix does not conflict with an existing @@ -683,7 +682,7 @@
Extensibility
- If ns is the HTML namespace, and the node's [=Element/local name=] is "
template" (this is a [^template^] element), append to markup the result of XML serializing a DocumentFragment node given - node's template contents (aDocumentFragment), + node's template contents (a {{DocumentFragment}}), inherited ns, map, prefix index, and require well-formed. @@ -719,7 +718,7 @@Extensibility
and return a local default namespace value defined by a default namespace attribute if one exists. Otherwise it returns null. -When recording the namespace information for an
Element+When recording the namespace information for an {{Element}} element, given a namespace prefix map map and a local prefixes map (initially empty), run the following steps: @@ -881,7 +880,7 @@
Extensibility
Serializing an Element's attributes
-The XML serialization of the attributes of an
Element+The XML serialization of the attributes of an {{Element}} element together with a namespace prefix map map, a generated namespace prefix index prefix index reference, an [=ordered map=] local prefixes map, @@ -939,7 +938,7 @@
Extensibility
- the attr's [=Attr/namespace prefix=] is null and ignore namespace definition attribute is true (the - Element's default namespace attribute is to be skipped); + {{Element}}'s default namespace attribute is to be skipped);
- the attr's [=Attr/namespace prefix=] is not null and either
@@ -1109,10 +1108,10 @@
- The DOM specification [[!DOM4]] defines the following terms used in this document: - -Extensibility
prefix index, and require well-formed. -This will serialize any number of {{ProcessingInstruction}} and Comment +
This will serialize any number of {{ProcessingInstruction}} and {{Comment}} nodes both before and after the [=document element=], including - at most one {{DocumentType}} node. (Text nodes are not allowed as children of the - Document.)
+ at most one {{DocumentType}} node. ({{Text}} nodes are not allowed as children of the + {{Document}}.)- Return serialized document. @@ -1384,19 +1383,6 @@
Dependencies
- The insertAdjacentHTML method;
-
- The following terms used in this document are defined by [[DOM]]:- The Attr interface -
- The Comment interface - -
- The DocumentFragment interface -
- The Element interface -
- The Node interface -
- The Range interface -
- The Text interface -
From 1bfc00c22dbb0c950e32eb0c84403c93bbcfa4c9 Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:47:55 +0200 Subject: [PATCH 37/67] Editorial: Remove redundant 'the' or 'this' referring to variables --- index.html | 133 ++++++++++++++++++++++++++--------------------------- 1 file changed, 64 insertions(+), 69 deletions(-) diff --git a/index.html b/index.html index 20b0924..ec2bbcf 100644 --- a/index.html +++ b/index.html @@ -419,9 +419,9 @@ Extensibility
-
- If require well-formed is true, - and this node's [=Element/local name=] contains the character + and node's [=Element/local name=] contains the character "
:" (U+003A COLON) or does not match the XML Name production, then - throw an exception; the serialization of this node would not be a well-formed + throw an exception; the serialization of node would not be a well-formed element.- Let markup be the string "
<" (U+003C LESS-THAN SIGN). @@ -451,7 +451,7 @@Extensibility
local prefixes map.The above step will update map with any found namespace prefix - definitions, add the found prefix definitions to the local prefixes map and + definitions, add the found prefix definitions to local prefixes map and return a local default namespace value defined by a default namespace attribute if one exists. Otherwise it returns null.
@@ -469,13 +469,13 @@Extensibility
node's [=Element/local name=].- Otherwise, append to qualified name node's - [=Element/local name=]. The node's + [=Element/local name=]. node's [=Element/namespace prefix=] if it exists, is dropped.
- Append qualified name to markup.
- Otherwise, inherited ns is not equal to ns (the node's +
- Otherwise, inherited ns is not equal to ns (node's own namespace is different from the context namespace of its parent). Run these sub-steps: -
- Otherwise, the node has a local default namespace that matches +
- Otherwise, node has a local default namespace that matches ns. Append to qualified name node's [=Element/local name=], let inherited ns be ns, and append qualified name to markup. @@ -640,8 +639,8 @@
Extensibility
given map, prefix index, local prefixes map, ignore namespace definition attribute, and require well-formed. -- If ns is the HTML namespace, and the node's [=tree/children=] - is empty, and the node's [=Element/local name=] matches any +
- If ns is the HTML namespace, and node's [=tree/children=] + is empty, and node's [=Element/local name=] matches any one of the following void elements: "
area", "base", @@ -670,16 +669,16 @@Extensibility
and set skip end tag to true. -- If ns is not the HTML namespace, and the node's +
- If ns is not the HTML namespace, and node's [=tree/children=] is empty, then append "
/" (U+002F SOLIDUS) to markup and set skip end tag to true.- Append "
>" (U+003E GREATER-THAN SIGN) to markup.- If skip end tag is true, then return markup and skip the remaining - steps. The node is a leaf-node. + steps. node is a leaf-node. -
- If ns is the HTML namespace, and the node's +
- If ns is the HTML namespace, and node's [=Element/local name=] is "
template" (this is a [^template^] element), append to markup the result of XML serializing a DocumentFragment node given node's template contents (a {{DocumentFragment}}), @@ -714,7 +713,7 @@Extensibility
@@ -349,7 +350,7 @@This following algorithm will update the namespace prefix map with any found namespace - prefix definitions, add the found prefix definitions to the local prefixes map, + prefix definitions, add the found prefix definitions to local prefixes map, and return a local default namespace value defined by a default namespace attribute if one exists. Otherwise it returns null.
@@ -739,14 +738,14 @@Extensibility
- Let attribute prefix be attr's [=Attr/namespace prefix=]. -
- If the attribute namespace is the XMLNS namespace, then: +
- If attribute namespace is the XMLNS namespace, then:
@@ -808,7 +807,7 @@
- If attribute prefix is null, then attr is a default - namespace declaration. Set the default namespace attr value to attr's + namespace declaration. Set default namespace attr value to attr's [=Attr/value=] and stop running these steps, returning to Main to visit the next attribute. -
- Otherwise, the attribute prefix is not null and attr +
- Otherwise, attribute prefix is not null and attr is a namespace prefix definition. Run the following steps:
- Let prefix definition be attr's [=Attr/local name=]. @@ -770,15 +769,15 @@
Extensibility
to visit the next attribute.This step avoids adding duplicate prefix definitions for the same namespace - in the map. This has the side-effect of avoiding later serialization of + in map. This has the side-effect of avoiding later serialization of duplicate namespace prefix declarations in any descendant nodes.
- Add the prefix prefix definition to map given namespace namespace definition. -
- Add prefix definition as a new key to the - local prefixes map, with the namespace definition as the - key's value replacing null with the empty string if applicable. +
- Add prefix definition as a new key to local prefixes map, with + namespace definition as the key's value replacing null with the empty string if + applicable.
Extensibility
details.-From 77a13da6518af642910cdbe426a81085300bf880 Mon Sep 17 00:00:00 2001 From: Ms2gerTo copy a namespace prefix map map means to copy the map's +
To copy a namespace prefix map map means to copy map's keys into a new empty namespace prefix map, and to copy each of the values in the namespace prefix list associated with each keys' value into a new list which is associated with the respective key in the new map. @@ -833,7 +832,7 @@
Extensibility
- If prefix matches preferred prefix, then stop running these steps and return prefix. -
- If prefix is the last item in the candidates list, then stop running +
- If prefix is the last item in candidates list, then stop running these steps and return prefix. @@ -890,7 +889,7 @@
Extensibility
- Let result be the empty string. -
- Let localname set be a new empty namespace localname set. This +
- Let localname set be a new empty namespace localname set. localname set will contain tuples of unique attribute [=Attr/namespace=] and [=Attr/local name=] pairs, and is populated as each attr is processed. This set is used to [optionally] enforce @@ -902,14 +901,13 @@
Extensibility
- Loop: [=list/For each=] attr of element's [=Element/attribute list=]:
-
-- If require well-formed is true, and the - localname set contains a tuple whose values match those of a new tuple consisting - of attr's [=Attr/namespace=] and +
- If require well-formed is true, and localname set contains a tuple + whose values match those of a new tuple consisting of attr's [=Attr/namespace=] and [=Attr/local name=], then throw an exception; the serialization of - this attr would fail to produce a well-formed element serialization. + attr would fail to produce a well-formed element serialization.
- Create a new tuple consisting of attr's [=Attr/namespace=] and - [=Attr/local name=], and add it to the localname set. + [=Attr/local name=], and add it to localname set.
- Let attribute namespace be attr's [=Attr/namespace=]. @@ -929,29 +927,28 @@
Extensibility
- If any of the following are true, then stop running these steps and goto Loop to visit the next attribute:
-
@@ -968,12 +965,12 @@- the attr's [=Attr/value=] is the XML namespace; +
- attr's [=Attr/value=] is the XML namespace;
The XML namespace cannot be redeclared and survive round-tripping (unless it defines the prefix "
-xml"). To avoid this problem, this algorithm always prefixes elements in the XML namespace with "xml" and drops any related definitions as seen in the above condition.- the attr's [=Attr/namespace prefix=] is null and +
- attr's [=Attr/namespace prefix=] is null and ignore namespace definition attribute is true (the {{Element}}'s default namespace attribute is to be skipped); -
- the attr's [=Attr/namespace prefix=] is not null and either +
- attr's [=Attr/namespace prefix=] is not null and either
-
- and furthermore that the attr's [=Attr/local name=] (as the prefix to + and furthermore that attr's [=Attr/local name=] (as the prefix to find) is found in map given the namespace consisting - of the attr's [=Attr/value=] (the current namespace prefix + of attr's [=Attr/value=] (the current namespace prefix definition was exactly defined previously—on an ancestor element not the current element whose attributes are being processed).- the attr's [=Attr/local name=] is - not a key contained in the local prefixes map, or +
- attr's [=Attr/local name=] is + not a key contained in local prefixes map, or -
- the attr's [=Attr/local name=] is present in the - local prefixes map but the value of the key is not attr's - [=Attr/value=] +
- attr's [=Attr/local name=] is present in local prefixes map + but the value of the key is not attr's [=Attr/value=]
Extensibility
empty string, then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). -- If the attr's [=Attr/namespace prefix=] matches the string +
- If attr's [=Attr/namespace prefix=] matches the string "
xmlns", then let candidate prefix be the string "xmlns".- Otherwise, the attribute namespace in not the XMLNS namespace. Run +
- Otherwise, attribute namespace in not the XMLNS namespace. Run these steps:
- Let candidate prefix be the result of generating a prefix providing @@ -1002,11 +999,10 @@
Extensibility
- If candidate prefix is not null, then append to result the concatenation of candidate prefix with "
:" (U+003A COLON). -- If require well-formed is true, and this - attr's [=Attr/local name=] contains the character - "
:" (U+003A COLON) or does not match the XML Name production or equals - "xmlns" and attribute namespace is null, then - throw an exception; the serialization of this attr would not be a +- If require well-formed is true, and attr's [=Attr/local name=] + contains the character "
:" (U+003A COLON) or does not match the XML Name + production or equals "xmlns" and attribute namespace is null, then + throw an exception; the serialization of attr would not be a well-formed attribute.- Append the following strings to result, in the order listed: @@ -1032,7 +1028,7 @@
Extensibility
@@ -1093,7 +1088,7 @@
- If require well-formed is true, and attribute value contains characters that are not matched by the XML Char - production, then throw an exception; the serialization of this attribute value + production, then throw an exception; the serialization of attribute value would fail to produce a well-formed element serialization.
- If attribute value is null, then return the empty string. @@ -1069,8 +1065,7 @@
Extensibility
- Let the value of prefix index be incremented by one. -
- Add to map the generated prefix given the - new namespace namespace. +
- Add to map generated prefix given new namespace.
- Return the value of generated prefix.
Extensibility
must run the following steps:If require well-formed is true, and node's [=document element=] is - null, then throw an exception; the serialization of this node would not be a + null, then throw an exception; the serialization of node would not be a well-formed document.
Otherwise, run the following steps: @@ -1132,7 +1127,7 @@
Extensibility
contains characters that are not matched by the XML Char production or contains "--" (two adjacent U+002D HYPHEN-MINUS characters) or ends with a "-" (U+002D HYPHEN-MINUS) character, then throw an exception; the - serialization of this node's [=CharacterData/data=] would not be well-formed. + serialization of node's [=CharacterData/data=] would not be well-formed.Otherwise, return the concatenation of "
<!--", node's [=CharacterData/data=], and "-->". @@ -1174,7 +1169,7 @@Extensibility
- If require well-formed is true, and node's [=CharacterData/data=] contains characters that are not matched by the XML Char production, then - throw an exception; the serialization of this node's [=CharacterData/data=] + throw an exception; the serialization of node's [=CharacterData/data=] would not be well-formed.
- Let markup be node's [=CharacterData/data=]. @@ -1235,13 +1230,13 @@
Extensibility
- If require well-formed is true, and node's [=DocumentType/public ID=] contains characters that are not matched by the XML PubidChar production, then - throw an exception; the serialization of this node would not be a well-formed + throw an exception; the serialization of node would not be a well-formed document type declaration.
- If require well-formed is true, and node's [=DocumentType/system ID=] contains characters that are not matched by the XML Char production or that contains both a "
"" (U+0022 QUOTATION MARK) and a "'" (U+0027 APOSTROPHE), - then throw an exception; the serialization of this node would not be a + then throw an exception; the serialization of node would not be a well-formed document type declaration.- Let markup be the empty string. @@ -1292,7 +1287,7 @@
Extensibility
". +- Otherwise, return the concatenation of "
<!--", node's + [=CharacterData/data=], and "-->". +Date: Mon, 17 Aug 2026 00:47:57 +0200 Subject: [PATCH 42/67] Editorial: Cross-reference 'is empty' --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index acc7ffa..7af476a 100644 --- a/index.html +++ b/index.html @@ -636,7 +636,7 @@ Extensibility
ignore namespace definition attribute, and require well-formed.- If ns is the HTML namespace, and node's [=tree/children=] - is empty, and node's [=Element/local name=] matches any + [=set/is empty=], and node's [=Element/local name=] matches any one of the following void elements: "
area", "base", @@ -665,8 +665,8 @@Extensibility
and set skip end tag to true. -- If ns is not the HTML namespace, and node's - [=tree/children=] is empty, then append "
/" (U+002F SOLIDUS) to markup +- If ns is not the HTML namespace, and node's [=tree/children=] + [=set/is empty=], then append "
/" (U+002F SOLIDUS) to markup and set skip end tag to true.- Append "
>" (U+003E GREATER-THAN SIGN) to markup. From 45abffb6970b45903a8405e8011c97c20fcba10f Mon Sep 17 00:00:00 2001 From: Ms2gerDate: Mon, 17 Aug 2026 00:47:57 +0200 Subject: [PATCH 43/67] Editorial: Redefine namespace prefix map as an ordered map and clarify algorithms --- index.html | 159 ++++++++++++++++++++++++++++------------------------- 1 file changed, 83 insertions(+), 76 deletions(-) diff --git a/index.html b/index.html index 7af476a..68fd5da 100644 --- a/index.html +++ b/index.html @@ -325,10 +325,9 @@ Extensibility
the {{Element}} to match its own namespace. The algorithm assumes no namespace (null) to start. -- Let prefix map be a new namespace prefix map. +
- Let |prefix map:namespace prefix map| be «» (a namespace prefix map). -
- Add the XML namespace with prefix value "
xml" to - prefix map. +- Add "
xml" to prefix map given the XML namespace.- Let prefix index be a generated namespace prefix index with value
1. The generated namespace prefix index is used to generate a new unique @@ -428,8 +427,8 @@Extensibility
- Let ignore namespace definition attribute be false. -
- Given prefix map, copy a namespace prefix map and let - map be the result. +
- Let |map:namespace prefix map| be the result of copy a namespace prefix map given + prefix map.
- Let local prefixes map be an empty map. The map has unique prefix strings as its keys, with corresponding namespaces as the map's key values (in this map, the null namespace is @@ -483,7 +482,7 @@
Extensibility
- Let candidate prefix be the result of retrieving a preferred prefix string prefix from map given - namespace ns. + ns.
The above can return null if no namespace key ns exists in map.
@@ -544,7 +543,7 @@Extensibility
then let prefix be the result of generating a prefix providing as input map, ns, and prefix index. -- Add prefix to map given namespace ns. +
- Add prefix to map given ns.
- Append to qualified name the concatenation of prefix, "
:" (U+003A COLON), and node's [=Element/local name=]. @@ -758,14 +757,14 @@Extensibility
having no namespace), then let namespace definition be null instead. -- If prefix definition is found in map given the namespace +
- If prefix definition is found in map given namespace definition, then [=iteration/continue=].
This step avoids adding duplicate prefix definitions for the same namespace in map. This has the side-effect of avoiding later serialization of duplicate namespace prefix declarations in any descendant nodes.
-- Add the prefix prefix definition to map given namespace +
- Add prefix definition to map given namespace definition.
- Add prefix definition as a new key to local prefixes map, with @@ -785,88 +784,98 @@
Extensibility
The Namespace Prefix Map
-A namespace prefix map is a map that associates namespace and - namespace prefix lists, where namespace values are the - map's unique keys (which can include the null value representing no namespace), and - ordered lists of associated prefix values are the map's key values. The - namespace prefix map will be populated by previously seen namespaces and all their - previously encountered prefix associations for a given node and its ancestors. +
A namespace prefix map is an ordered map from strings or null + to lists of strings.
-Note: the last seen prefix for a given - namespace is at the end of its respective list. The list is searched to - find potentially matching prefixes, and if no matches are found for the given - namespace, then the last prefix in the list is used. See - copy a namespace prefix map and retrieve a preferred prefix string for additional - details.
++The keys are namespaces, with null representing no namespace; the values are + lists of prefixes that map to that namespace. + +
An empty namespace prefix map will be created at the start of the + XML serialization algorithm. Whenever a new {{Element}} is encountered, the map will be + cloned (copy a namespace prefix map) and new associations will be added for that + {{Element}} (primarily in recording the namespace information, but also when adding + new namespace declarations because no prefix is available for a particular namespace). + +
The last seen prefix for a given namespace is at the end of its respective [=list=]. + When serializing, the [=Element=]'s [=Element/namespace prefix=] will be used if it is in the + [=list=]; otherwise the last prefix in the [=list=] is used. See + retrieve a preferred prefix string for additional details.
+-To copy a namespace prefix map map means to copy map's - keys into a new empty namespace prefix map, and to copy each of the values in the - namespace prefix list associated with each keys' value into a new - list which is associated with the respective key in the new map. +
To copy a namespace prefix map map: +
+
- Let |copy| be a new [=namespace prefix map=]. +
- +
[=map/For each=] |key| → |value| in map: +
+
+- Set |copy|[|key|] to a [=list/clone=] of |value|. +
- Return |copy|. +
To retrieve a preferred prefix string - preferred prefix from the namespace prefix map map given a namespace - ns, the user agent must: + preferred prefix (a string or null) from the namespace prefix map map + given a namespace ns:
-
- Let candidates list be the result of retrieving a list from map - where there exists a key in map that matches the value of ns or if there - is no such key, then stop running these steps, and return the null value. +
- If map does not [=map/contain=] ns, return null. -
- Otherwise, for each prefix value prefix in candidates list, iterating - from beginning to end: +
- Let candidates be map[ns]. -
There will always be at least one prefix value in the list.
+- [=Assert=]: candidates [=list/is not empty=].
--
+- If prefix matches preferred prefix, then stop running these steps - and return prefix. +
- [=list/For each=] prefix of candidates: -
- If prefix is the last item in candidates list, then stop running - these steps and return prefix. -
+
+ +- If prefix is preferred prefix, return prefix. +
- Return candidates[[=list/size=] of candidates - 1].
-To check if a prefix string prefix is found in a - namespace prefix map map given a namespace ns, the user agent must: +
To check if a string prefix is found in a namespace prefix map + map given a namespace ns:
-
- Let candidates list be the result of retrieving a list from map - where there exists a key in map that matches the value of ns or if there - is no such key, then stop running these steps, and return false. +
- If map does not [=map/contain=] ns, return false. + +
- Let candidates be map[ns]. -
- If prefix occurs at least once in candidates list, return - true, otherwise return false. +
- If |candidates| [=list/contains=] prefix, return true, otherwise return false.
-+To add a prefix string prefix to the namespace prefix map - map given a namespace ns, the user agent must: +
To add a string prefix to a namespace prefix map map + given a namespace ns:
-
- Let candidates list be the result of retrieving a list from map - where there exists a key in map that matches the value of ns or if there - is no such key, then let candidates list be null. - -
- If candidates list is null, then create a new list with - prefix as the only item in the list, and associate that list with a new - key ns in map. - -
- Otherwise, append prefix to the end of candidates list. - -
The steps in retrieve a preferred prefix string use the list to - track the most recently used (MRU) prefix associated with a given namespace, which - will be the prefix at the end of the list. This list can contain duplicates of the - same prefix value seen earlier (and that's OK).
+- +
If |map| does not [=map/contain=] |ns|: +
+
+- Let |candidates| be « |prefix| ». +
- Set |map|[|ns|] to |candidates|. +
- +
Otherwise: +
+
- Let |candidates| be |map|[|ns|]. +
- [=list/Append=] |prefix| to |candidates|. +
The steps in retrieve a preferred prefix string use the list to track + the most recently used prefix associated with a given namespace, which will be the prefix at the + end of the list. This list can contain duplicates of the same prefix seen earlier (and that's + OK).
+Serializing an Element's attributes
@@ -908,10 +917,11 @@Extensibility
- If attribute namespace is not null, then run these sub-steps:
-
- Let candidate prefix be the result of - retrieving a preferred prefix string from map given namespace - attribute namespace with preferred prefix being attr's - [=Attr/namespace prefix=]. +
- Let |prefix| be attr's [=Attr/namespace prefix=]. + +
- Set candidate prefix to the result of + retrieving a preferred prefix string |prefix| from map given + attribute namespace.
- If attribute namespace is the XMLNS namespace, then run these steps: @@ -925,11 +935,10 @@
Extensibility
problem, this algorithm always prefixes elements in the XML namespace with "xml" and drops any related definitions as seen in the above condition. -- attr's [=Attr/namespace prefix=] is null and - ignore namespace definition attribute is true (the +
- |prefix| is null and ignore namespace definition attribute is true (the {{Element}}'s default namespace attribute is to be skipped); -
- attr's [=Attr/namespace prefix=] is not null and either +
- |prefix| is not null and either
- and furthermore that attr's [=Attr/local name=] (as the prefix to - find) is found in map given the namespace consisting - of attr's [=Attr/value=] (the current namespace prefix + and furthermore that attr's [=Attr/local name=] is found in + map given attr's [=Attr/value=] (the current namespace prefix definition was exactly defined previously—on an ancestor element not the current element whose attributes are being processed). @@ -956,9 +964,8 @@
- attr's [=Attr/local name=] is not a key contained in local prefixes map, or @@ -937,9 +946,8 @@
Extensibility
- attr's [=Attr/local name=] is present in local prefixes map but the value of the key is not attr's [=Attr/value=]
Extensibility
empty string, then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). -- If attr's [=Attr/namespace prefix=] matches the string - "
xmlns", then let candidate prefix be the string - "xmlns". +- If |prefix| matches the string "
xmlns", then let + candidate prefix be the string "xmlns".- Otherwise, attribute namespace in not the XMLNS namespace. Run @@ -1056,7 +1063,7 @@
Extensibility
- Let the value of prefix index be incremented by one. -
- Add to map generated prefix given new namespace. +
- Add generated prefix to map given new namespace.
- Return the value of generated prefix. From 9bc916b4c42fe7aafe1a5d86af28e6d741c54d68 Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:47:57 +0200 Subject: [PATCH 44/67] Editorial: Clarify the prefix index handling --- index.html | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index 68fd5da..cdb0a80 100644 --- a/index.html +++ b/index.html @@ -329,18 +329,19 @@ Extensibility
- Add "
xml" to prefix map given the XML namespace. -- Let prefix index be a generated namespace prefix index with value -
1. The generated namespace prefix index is used to generate a new unique - prefix value when no suitable existing namespace prefix is available to serialize a - node's [=Element/namespace=] (or the [=Attr/namespace=] of one of the - attributes in node's [=Element/attribute list=]). - See the generate a prefix algorithm. +- +
Let |prefix index:integer| be 1. +
prefix index is used to generate a new unique prefix when no + suitable existing namespace prefix is available to serialize a node's [=Element/namespace=] + (or the [=Attr/namespace=] of one of the attributes in + node's [=Element/attribute list=]). + See the generate a prefix algorithm.
- Return the result of running the XML serialization algorithm given node, - namespace, prefix map, generated namespace prefix index reference - to prefix index, and require well-formed. If an - exception occurs during the execution of the algorithm, - then catch that exception and throw an {{"InvalidStateError"}} {{DOMException}}. + namespace, prefix map, a mutable reference to prefix index, and + require well-formed. + If an exception occurs during the execution of the + algorithm, then catch that exception and throw an {{"InvalidStateError"}} {{DOMException}}.
Extensibility
a {{Node}} |node:Node|, a string |namespace:string|, a [=namespace prefix map=] |prefix map:namespace prefix map|, - a generated namespace prefix index |prefix index:generated namespace prefix index|, + a mutable reference to an integer |prefix index:mutable reference to an integer|, and a boolean require well-formed, must run the following steps: @@ -407,7 +408,7 @@Extensibility
an {{Element}} |node:Element|, a string |namespace:string|, a [=namespace prefix map=] |prefix map:namespace prefix map|, - a generated namespace prefix index |prefix index:generated namespace prefix index|, + a mutable reference to an integer |prefix index:mutable reference to an integer|, and a boolean require well-formed, must run the following steps: @@ -540,7 +541,7 @@Extensibility
- If local prefixes map contains a key matching prefix, - then let prefix be the result of generating a prefix providing as input + then let prefix be the result of generating a prefix given map, ns, and prefix index.
- Add prefix to map given ns. @@ -882,8 +883,8 @@
Extensibility
The XML serialization of the attributes of an {{Element}} - element together with a namespace prefix map map, a - generated namespace prefix index prefix index reference, + element together with a namespace prefix map map, + a mutable reference to an integer prefix index, an [=ordered map=] local prefixes map, a boolean ignore namespace definition attribute, and a boolean require well-formed, is the result of the following algorithm: @@ -971,8 +972,8 @@
Extensibility
- Otherwise, attribute namespace in not the XMLNS namespace. Run these steps:
-
- Let candidate prefix be the result of generating a prefix providing - map, attribute namespace, and prefix index as input. +
- Let candidate prefix be the result of generating a prefix given + map, attribute namespace, and prefix index.
- Append the following to result, in the order listed:
@@ -1054,14 +1055,14 @@
Extensibility
To generate a prefix given a - namespace prefix map map, a string new namespace, and a reference to - a generated namespace prefix index prefix index, the user agent must run the - following steps: + namespace prefix map map, a string new namespace, and a mutable + reference to an integer prefix index: +
@@ -630,9 +630,8 @@
- Let generated prefix be the concatenation of the string "
ns" and the current numerical value of prefix index. -- Let the value of prefix index be incremented by one. +
- Increment the value of prefix index by one.
- Add generated prefix to map given new namespace. @@ -1080,7 +1081,7 @@
Extensibility
a {{Document}} |node:Document|, a string |namespace:string|, a [=namespace prefix map=] |prefix map:namespace prefix map|, - a generated namespace prefix index |prefix index:generated namespace prefix index|, + a mutable reference to an integer |prefix index:mutable reference to an integer|, and a boolean require well-formed, must run the following steps: @@ -1198,7 +1199,7 @@Extensibility
a {{DocumentFragment}} |node:DocumentFragment|, a string |namespace:string|, a [=namespace prefix map=] |prefix map:namespace prefix map|, - a generated namespace prefix index |prefix index:generated namespace prefix index|, + a mutable reference to an integer |prefix index:mutable reference to an integer|, and a boolean require well-formed, must run the following steps: From 105ddebf412485c48d40366af57b3241b307a594 Mon Sep 17 00:00:00 2001 From: Ms2gerDate: Mon, 17 Aug 2026 00:47:57 +0200 Subject: [PATCH 45/67] Editorial: Cross-reference 'throw an exception' --- index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index cdb0a80..dc86372 100644 --- a/index.html +++ b/index.html @@ -491,7 +491,7 @@ Extensibility
- If prefix matches "
xmlns", then run the following steps:-
@@ -613,7 +613,7 @@- If require well-formed is true, then throw an error. An +
- If require well-formed is true, then throw an exception. An {{Element}} with [=Element/namespace prefix=] "
xmlns" will not legally round-trip in a conforming XML parser. @@ -954,16 +954,16 @@Extensibility
- If require well-formed is true, and attr's [=Attr/value=] is the - XMLNS namespace, then throw an exception; the serialization of this attribute would - produce invalid XML because the XMLNS namespace is reserved and cannot be applied - as an element's namespace via XML parsing. + XMLNS namespace, then throw an exception; the serialization of this + attribute would produce invalid XML because the XMLNS namespace is reserved and + cannot be applied as an element's namespace via XML parsing.
DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.
- If require well-formed is true, and attr's [=Attr/value=] is the - empty string, then throw an exception; namespace prefix declarations cannot be used to - undeclare a namespace (use a default namespace declaration instead). + empty string, then throw an exception; namespace prefix declarations cannot be used + to undeclare a namespace (use a default namespace declaration instead).
- If |prefix| matches the string "
xmlns", then let candidate prefix be the string "xmlns". From dba15be588b472aa29c85af5a86ce4fa4e4b16b4 Mon Sep 17 00:00:00 2001 From: Ms2gerDate: Mon, 17 Aug 2026 00:47:58 +0200 Subject: [PATCH 46/67] Editorial: Remove some redundant prose when calling algorithms --- index.html | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index dc86372..f256e44 100644 --- a/index.html +++ b/index.html @@ -566,7 +566,7 @@ Extensibility
- "
="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);- The result of serializing an attribute value given ns and - require well-formed as input; + require well-formed;
- "
"" (U+0022 QUOTATION MARK).Extensibility
- "
="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);- The result of serializing an attribute value given ns and - require well-formed as input; + require well-formed;
- "
"" (U+0022 QUOTATION MARK).Extensibility
preserving its original [=Element/namespace=]. -- Append to markup the result of the - XML serialization of node's attributes - given map, prefix index, local prefixes map, +
- Append to markup the result of the [=XML serialization of the attributes=] of + node given map, prefix index, local prefixes map, ignore namespace definition attribute, and require well-formed.
- If ns is the HTML namespace, and node's [=tree/children=] @@ -883,7 +882,7 @@
Extensibility
The XML serialization of the attributes of an {{Element}} - element together with a namespace prefix map map, + element given a namespace prefix map map, a mutable reference to an integer prefix index, an [=ordered map=] local prefixes map, a boolean ignore namespace definition attribute, and @@ -985,8 +984,8 @@
Extensibility
- "
="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); -- The result of serializing an attribute value given attribute namespace - and require well-formed as input; +
- The result of serializing an attribute value given + attribute namespace and require well-formed;
- "
"" (U+0022 QUOTATION MARK). @@ -1011,7 +1010,7 @@Extensibility
- "
="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);- The result of serializing an attribute value given attr's - [=Attr/value=] and require well-formed as input; + [=Attr/value=] and require well-formed;
- "
"" (U+0022 QUOTATION MARK). From 572bbcb05533bbde147775b037baad9cee65a136 Mon Sep 17 00:00:00 2001 From: Ms2gerDate: Mon, 17 Aug 2026 00:47:58 +0200 Subject: [PATCH 47/67] Editorial: Clarify note about children of the document --- index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index f256e44..a209a14 100644 --- a/index.html +++ b/index.html @@ -1103,9 +1103,8 @@ Extensibility
This will serialize any number of {{ProcessingInstruction}} and {{Comment}} - nodes both before and after the [=document element=], including - at most one {{DocumentType}} node. ({{Text}} nodes are not allowed as children of the - {{Document}}.)
+ nodes both before and after the [=document element=], as well as at most one + {{DocumentType}} node. ({{Text}} nodes are not allowed as children of a {{Document}}.)- Return serialized document. From b2c63b797eed05eec946e0c5c77d5fb7d8ebfdbb Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:47:58 +0200 Subject: [PATCH 48/67] Editorial: Remove reference to void elements --- index.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index a209a14..5990e9c 100644 --- a/index.html +++ b/index.html @@ -635,8 +635,7 @@ Extensibility
ignore namespace definition attribute, and require well-formed.- If ns is the HTML namespace, and node's [=tree/children=] - [=set/is empty=], and node's [=Element/local name=] matches any - one of the following void elements: + [=set/is empty=], and node's [=Element/local name=] is one of the following: "
area", "base", "basefont", @@ -1371,8 +1370,7 @@Dependencies
- Parsing concepts: HTML parser; parsing XHTML documents; - XML parser; -
- void elements + XML parser
- The template's template contents
- The innerHTML property;
- The outerHTML property; From d44dcba34bde2ce946819c68cdf4e9389ef43b86 Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:47:59 +0200 Subject: [PATCH 49/67] Editorial: Clarify some prose --- index.html | 84 ++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/index.html b/index.html index 5990e9c..cab3fec 100644 --- a/index.html +++ b/index.html @@ -420,7 +420,7 @@ Extensibility
throw an exception; the serialization of node would not be a well-formed element. -- Let markup be the string "
<" (U+003C LESS-THAN SIGN). +- Let markup be "
<" (U+003C LESS-THAN SIGN).- Let qualified name be the empty string. @@ -451,28 +451,27 @@
Extensibility
return a local default namespace value defined by a default namespace attribute if one exists. Otherwise it returns null. -- Let inherited ns be a copy of namespace. +
- Let inherited ns be namespace.
- Let ns be node's [=Element/namespace=]. -
- If inherited ns is equal to ns, then: +
- If inherited ns is ns, then:
-
- If local default namespace is not null, then set ignore namespace definition attribute to true. -
- If ns is the XML namespace, then append to - qualified name the concatenation of the string "
xml:" and - node's [=Element/local name=]. +- If ns is the XML namespace, then append the concatenation of + "
xml:" and node's [=Element/local name=] to qualified name. -- Otherwise, append to qualified name node's - [=Element/local name=]. node's - [=Element/namespace prefix=] if it exists, is dropped. +
- Otherwise, append node's [=Element/local name=] to qualified name. + node's [=Element/namespace prefix=] if it exists, is + dropped.
- Append qualified name to markup.
- Otherwise, inherited ns is not equal to ns (node's - own namespace is different from the context namespace of its parent). Run these sub-steps: +
- Otherwise (inherited ns is not equal to ns; node's + own namespace is different from the context namespace of its parent): -
- Otherwise, node has a local default namespace that matches - ns. Append to qualified name node's - [=Element/local name=], let inherited ns be ns, +
- Otherwise, local default namespace is ns. + Append node's [=Element/local name=] to qualified name, + let inherited ns be ns, and append qualified name to markup.
All of the combinations where ns is not equal to @@ -737,8 +734,8 @@
Extensibility
namespace declaration. Set default namespace attr value to attr's [=Attr/value=], and [=iteration/continue=]. -- Otherwise, attribute prefix is not null and attr - is a namespace prefix definition. Run the following steps: +
- Otherwise (attribute prefix is not null and attr + is a namespace prefix definition):
- Let prefix definition be attr's [=Attr/local name=]. @@ -914,7 +911,7 @@
Extensibility
- Let candidate prefix be null. -
- If attribute namespace is not null, then run these sub-steps: +
- If attribute namespace is not null, then:
-
- Let |prefix| be attr's [=Attr/namespace prefix=]. @@ -922,8 +919,7 @@
Extensibility
retrieving a preferred prefix string |prefix| from map given attribute namespace. -- If attribute namespace is the XMLNS namespace, then run - these steps: +
- If attribute namespace is the XMLNS namespace, then:
- If any of the following are true, then [=iteration/continue=]:
@@ -963,8 +959,8 @@
Extensibility
empty string, then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). -- If |prefix| matches the string "
xmlns", then let - candidate prefix be the string "xmlns". +- If |prefix| is "
xmlns", then let candidate prefix be + "xmlns".- Otherwise, attribute namespace in not the XMLNS namespace. Run @@ -977,7 +973,7 @@
Extensibility
- "
" (U+0020 SPACE); -- The string "
xmlns:"; +- "
xmlns:";- candidate prefix; @@ -991,10 +987,10 @@
Extensibility
- Append a "
" (U+0020 SPACE) to result. +- Append "
" (U+0020 SPACE) to result.- If candidate prefix is not null, then append to result - the concatenation of candidate prefix with "
:" (U+003A COLON). + the concatenation of candidate prefix and ":" (U+003A COLON).- If require well-formed is true, and attr's [=Attr/local name=] contains the character "
:" (U+003A COLON) or does not match the XML Name @@ -1002,7 +998,7 @@Extensibility
throw an exception; the serialization of attr would not be a well-formed attribute. -- Append the following strings to result, in the order listed: +
- Append the following to result, in the order listed:
- attr's [=Attr/local name=]; @@ -1057,7 +1053,7 @@
Extensibility
reference to an integer prefix index:-
- Let generated prefix be the concatenation of the string "
ns" and the +- Let generated prefix be the concatenation of "
ns" and the current numerical value of prefix index.- Increment the value of prefix index by one. @@ -1089,7 +1085,7 @@
Extensibility
null, then throw an exception; the serialization of node would not be a well-formed document. -- Otherwise, run the following steps: +
- Otherwise:
+
- Let serialized document be the empty string. @@ -1241,7 +1237,7 @@
Extensibility
- Let markup be the empty string. -
- Append the string "
<!DOCTYPE" to markup. +- Append "
<!DOCTYPE" to markup.- Append "
" (U+0020 SPACE) to markup. @@ -1253,7 +1249,7 @@Extensibility
- "
" (U+0020 SPACE); -- The string "
PUBLIC"; +- "
PUBLIC";- "
" (U+0020 SPACE); @@ -1270,7 +1266,7 @@Extensibility
- "
" (U+0020 SPACE); -- The string "
SYSTEM". +- "
SYSTEM".- If node's [=DocumentType/system ID=] is not the empty string, then append @@ -1323,13 +1319,13 @@
Extensibility
@@ -935,11 +940,13 @@
- If require well-formed is true, and node's [=ProcessingInstruction/target=] contains a "
:" (U+003A COLON) - character or is an ASCII case-insensitive match for the string "xml", then + character or is an ASCII case-insensitive match for "xml", then throw an exception; the serialization of node's [=ProcessingInstruction/target=] would not be well-formed.- If require well-formed is true, and node's [=CharacterData/data=] contains characters that are not matched by the XML - Char production or contains the string "
?>" (U+003F QUESTION MARK, + Char production or contains "?>" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN), then throw an exception; the serialization of node's [=CharacterData/data=] would not be well-formed. From f334ab4c382e73780a5b40e43a6c3bf6bb0d01ef Mon Sep 17 00:00:00 2001 From: Ms2gerDate: Mon, 17 Aug 2026 00:47:59 +0200 Subject: [PATCH 50/67] Editorial: Redefine local prefixes map as an ordered map and clarify algorithms --- index.html | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index cab3fec..a249773 100644 --- a/index.html +++ b/index.html @@ -431,12 +431,15 @@ Extensibility
- Let |map:namespace prefix map| be the result of copy a namespace prefix map given prefix map. -
- Let local prefixes map be an empty map. The map has unique prefix strings as its - keys, with corresponding namespaces as the map's key values (in this map, the null namespace is - represented by the empty string). +
- +
Let |local prefixes map:map| be « » (an [=ordered map=] from strings to strings). + +
Its keys will be prefixes, and its values will be namespaces. In this map, + the null namespace is represented by the empty string.
This map is local to each element. It is used to ensure there are no conflicting - prefixes if a new namespace prefix needs to be generated. + prefixes if a new namespace prefix attribute needs to be + generated. It is also used to enable skipping of duplicate prefix definitions when writing an element's attributes: the map allows the algorithm to distinguish between a prefix in the namespace prefix map that @@ -537,7 +540,7 @@
Extensibility
[=Element/attribute list=].-
- If local prefixes map contains a key matching prefix, +
- If local prefixes map [=map/contains=] prefix, then let prefix be the result of generating a prefix given map, ns, and prefix index. @@ -709,8 +712,8 @@
Extensibility
exists. Otherwise it returns null.When recording the namespace information for an {{Element}} - element, given a namespace prefix map map and a - local prefixes map (initially empty), run the following steps: + element, given a namespace prefix map map and an [=ordered map=] + local prefixes map, run the following steps:
- Let default namespace attr value be null. @@ -763,9 +766,11 @@
Extensibility
- Add prefix definition to map given namespace definition. -
- Add prefix definition as a new key to local prefixes map, with - namespace definition as the key's value replacing null with the empty string if - applicable. +
- If namespace definition is null, then set namespace definition to + the empty string. + +
- Set local prefixes map[prefix definition] to + namespace definition.
Extensibility
- |prefix| is not null and either
-
and furthermore that attr's [=Attr/local name=] is found in map given attr's [=Attr/value=] (the current namespace prefix From c2d3186b5014326be13de4518ffe703bc30eca35 Mon Sep 17 00:00:00 2001 From: Ms2ger- attr's [=Attr/local name=] is - not a key contained in local prefixes map, or +
- local prefixes map does not [=map/contain=] attr's + [=Attr/local name=], or -
- attr's [=Attr/local name=] is present in local prefixes map - but the value of the key is not attr's [=Attr/value=] +
- local prefixes map does [=map/contain=] attr's + [=Attr/local name=], but + local prefixes map[attr's [=Attr/local name=]] is not + attr's [=Attr/value=]
Date: Mon, 17 Aug 2026 00:47:59 +0200 Subject: [PATCH 51/67] Editorial: Drop 'context namespace' definition --- index.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index a249773..5d44756 100644 --- a/index.html +++ b/index.html @@ -318,12 +318,14 @@ Extensibility
a boolean require well-formed, run the following steps:-
- Let namespace be a context namespace with value null. - The context namespace tracks the XML serialization algorithm's current default - namespace. The context namespace is changed when either an {{Element}} has - a default namespace declaration, or the algorithm generates a default namespace declaration for - the {{Element}} to match its own namespace. The algorithm assumes no namespace - (null) to start. +
- +
Let |namespace:namespace| be null. + +
namespace tracks the XML serialization algorithm's current + default namespace. It is changed when either an {{Element}} has a default namespace + declaration, or the algorithm generates a default namespace declaration for the {{Element}} to + match its own namespace. + The algorithm assumes no namespace (null) to start.
- Let |prefix map:namespace prefix map| be «» (a namespace prefix map). @@ -519,7 +521,7 @@
Extensibility
a locally-defined default namespace declaration attribute) and its value is not the XML namespace, then let inherited ns get the value of local default namespace unless local default namespace is the empty - string in which case let it get null (the context namespace is changed to the + string in which case let it get null (the context namespace is changed to the declared default, rather than node's [=Element/namespace=]).Any default namespace definitions or namespace prefixes that define the @@ -595,7 +597,7 @@
Extensibility
- Let inherited ns be ns.
The new default namespace will be used in the serialization to define - node's [=Element/namespace=] and act as the context namespace for its + node's [=Element/namespace=] and act as the context namespace for its [=tree/children=].
- Append qualified name to markup. From 840a68f79beca966297e3bdb271ccd622d6fa3b0 Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:48:00 +0200 Subject: [PATCH 52/67] Editorial: Use explicit substeps for steps that do too much --- index.html | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 5d44756..4829fa9 100644 --- a/index.html +++ b/index.html @@ -519,9 +519,13 @@ Extensibility
- If local default namespace is not null (there exists a locally-defined default namespace declaration attribute) and its value is not the - XML namespace, then let inherited ns get the value of - local default namespace unless local default namespace is the empty - string in which case let it get null (the context namespace is changed to the + XML namespace, then: +
+
+ (the context namespace is changed to the declared default, rather than node's [=Element/namespace=]).- If local default namespace is the empty string, set + inherited ns to null. +
- Otherwise, set inherited ns to local default namespace. +
Any default namespace definitions or namespace prefixes that define the @@ -574,10 +578,13 @@
Extensibility
- If local default namespace is not null (there exists a - locally-defined default namespace declaration attribute), then let - inherited ns get local default namespace - unless local default namespace is the empty string in which case let - it get null. + locally-defined default namespace declaration attribute), then: + +
+
- If local default namespace is the empty string, set + inherited ns to null. +
- Otherwise, set inherited ns to local default namespace. +
- Otherwise, if local default namespace is null, or @@ -623,9 +630,13 @@
Extensibility
- Otherwise, local default namespace is ns. - Append node's [=Element/local name=] to qualified name, - let inherited ns be ns, - and append qualified name to markup. +
+
- Append node's [=Element/local name=] to qualified name. + +
- Let inherited ns be ns. + +
- Append qualified name to markup. +
All of the combinations where ns is not equal to inherited ns are handled above such that node will be serialized From 026f6d457f9589b0bf4c57fabe6de3bc022dcedd Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:48:00 +0200 Subject: [PATCH 53/67] Editorial: Use 'set' instead of 'let' where appropriate --- index.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 4829fa9..3df8e06 100644 --- a/index.html +++ b/index.html @@ -498,7 +498,7 @@ Extensibility
{{Element}} with [=Element/namespace prefix=] "xmlns" will not legally round-trip in a conforming XML parser. -- Let candidate prefix be prefix. +
- Set candidate prefix to prefix.
- Otherwise: + +
inherited ns is not equal to ns; node's + own [=Element/namespace=] is different from the context namespace. + To differentiate node's namespace from the context namespace, the steps below + will use a namespace prefix if one is available; if not, they will use or introduce a + default namespace declaration. +
- Let prefix be node's [=Element/namespace prefix=]. @@ -489,14 +499,15 @@
Extensibility
retrieving a preferred prefix string prefix from map given ns. -The above can return null if no namespace key ns exists - in map.
+candidate prefix will be null if no prefix was found that maps + to ns (not even prefix). In that case, this algorithm will + generate a new `xmlns` attribute and add any new prefix to map below.
- If prefix is "
xmlns", then:-
@@ -504,29 +515,31 @@- If require well-formed is true, then throw an exception. An - {{Element}} with [=Element/namespace prefix=] "
xmlns" - will not legally round-trip in a conforming XML parser. +- If require well-formed is true, then throw an exception. + An {{Element}} with [=Element/namespace prefix=] "
xmlns" + will not legally round-trip in a conforming XML parser.- Set candidate prefix to prefix.
Extensibility
matches the node's namespace. This prefix will be used in serialization even if the node doesn't have a real prefix. -->- Found a suitable namespace prefix: if candidate prefix is not - null (a namespace prefix is defined which maps to ns), then: + null, then: -
The following can serialize a different [=Element/namespace prefix=] than the - {{Element}}'s existing [=Element/namespace prefix=] if it already had one. However, the - retrieving a preferred prefix string algorithm already tried to match the existing - prefix if possible.
+Either node or one of its ancestors defines that + candidate prefix maps to node's [=Element/namespace=]. + +
The following could serialize a different prefix than node's + existing [=Element/namespace prefix=], if any. However, this only happens if this prefix + does not map to the correct namespace, as the retrieving a preferred prefix string + algorithm already tried to match the existing prefix.
+ -
- Append the concatenation of candidate prefix, "
:" (U+003A COLON), and node's [=Element/local name=] to qualified name. - There exists on node or node's ancestry a namespace - prefix definition that defines node's [=Element/namespace=]. -- If local default namespace is not null (there exists - a locally-defined default namespace declaration attribute) and its value is not the +
- If local default namespace is not null (node has a default + namespace declaration attribute) and is not the XML namespace, then:
- (the context namespace is changed to the - declared default, rather than node's [=Element/namespace=]). + +
- If local default namespace is the empty string, set inherited ns to null.
- Otherwise, set inherited ns to local default namespace.
It is possible that inherited ns differs from + node's [=Element/namespace=].
Any default namespace definitions or namespace prefixes that define the XML namespace are omitted when serializing attributes in @@ -539,11 +552,13 @@
Extensibility
By this step, there is no namespace or prefix mapping declaration in node (or any parent {{Node}} visited by this algorithm) that defines - prefix otherwise the step labelled Found a suitable namespace prefix would - have been followed. The sub-steps that follow will create a new namespace prefix declaration - for prefix and ensure that prefix does not conflict with an existing - namespace prefix declaration of the same [=Attr/local name=] in node's - [=Element/attribute list=].
+ a prefix that maps to node's [=Element/namespace=]; otherwise the step labelled + Found a suitable namespace prefix would have been followed. Ideally we would use + node's [=Element/namespace prefix=]. However, it could be the case that + node already declares its own prefix as mapping to something else than its own + namespace. In that case we will [=generating a prefix|generate a new prefix=] as a last + resort. In either case, the sub-steps that follow will serialize a new namespace prefix + declaration for the prefix we end up using.-
- If local prefixes map [=map/contains=] prefix, @@ -577,8 +592,8 @@
Extensibility
- "
"" (U+0022 QUOTATION MARK).- If local default namespace is not null (there exists a - locally-defined default namespace declaration attribute), then: +
- If local default namespace is not null (node has a + default namespace declaration attribute), then:
- If local default namespace is the empty string, set @@ -627,9 +642,13 @@
Extensibility
- "
"" (U+0022 QUOTATION MARK).- Otherwise, local default namespace is ns. +
- Otherwise: + +
local default namespace is ns. +
+ + require well-formed.
- Append node's [=Element/local name=] to qualified name. @@ -719,10 +738,10 @@
Extensibility
@@ -1324,6 +1328,7 @@ Recording the namespace
-This following algorithm will update the namespace prefix map with any found namespace - prefix definitions, add the found prefix definitions to local prefixes map, - and return a local default namespace value defined by a default namespace attribute if one - exists. Otherwise it returns null.
+This following algorithm will update the namespace prefix map with any + found namespace prefix definitions, add the found prefix definitions to + local prefixes map, and return a local default namespace value defined by a default + namespace attribute if one exists. Otherwise it returns null.
When recording the namespace information for an {{Element}} element, given a namespace prefix map map and an [=ordered map=] @@ -746,13 +765,15 @@
Extensibility
- If attribute namespace is the XMLNS namespace, then:
-
- If attribute prefix is null, then attr is a default - namespace declaration. Set default namespace attr value to attr's +
- If attribute prefix is null (attr is a default namespace + declaration), set default namespace attr value to attr's [=Attr/value=], and [=iteration/continue=]. -
- Otherwise (attribute prefix is not null and attr - is a namespace prefix definition): +
- Otherwise:
+
- attribute prefix is not null and attr is a namespace + prefix definition. +
- Let prefix definition be attr's [=Attr/local name=].
- Let namespace definition be attr's [=Attr/value=]. @@ -762,8 +783,9 @@
Extensibility
XML namespace definitions in prefixes are completely ignored (in order to avoid unnecessary work when there might be prefix conflicts). - XML namespaced elements are always handled uniformly by prefixing (and overriding - if necessary) the element's localname with the reserved "
+ {{Element}}s in the XML namespace are always handled uniformly by prefixing (and + overriding if necessary) the element's [=Element/local name=] with the reserved + "xml" prefix.xml" prefix.- If namespace definition is the empty string (the declarative form of having no namespace), then set namespace definition to null. @@ -904,14 +926,15 @@
Extensibility
- Let result be the empty string. -
- Let localname set be a new empty namespace localname set. - localname set will contain tuples of unique attribute - [=Attr/namespace=] and [=Attr/local name=] pairs, and is populated as - each attr is processed. This set is used to [optionally] enforce - the well-formed constraint that an element cannot have two attributes - with the same [=Attr/namespace=] and [=Attr/local name=]. This can occur when two - otherwise identical attributes on the same element differ only by their - prefix values. +
- Let localname set be « » (an empty [=ordered set=]). + +
localname set will contain tuples of unique attribute + (namespace, local name) pairs, and is populated as each attr is processed. If + require well-formed is true, it is used to enforce the well-formed constraint + that an element cannot have two attributes with the same [=Attr/namespace=] and + [=Attr/local name=]. This can occur when two otherwise identical attributes on the same + element differ only by their prefix values. If require well-formed is false, + localname set is unnecessary.
- [=list/For each=] attr of element's [=Element/attribute list=]:
@@ -962,28 +985,28 @@
-Extensibility
and furthermore that attr's [=Attr/local name=] is found in map given attr's [=Attr/value=] (the current namespace prefix - definition was exactly defined previously—on an ancestor element not the current - element whose attributes are being processed). + definition was exactly defined previously—on an ancestor element, not |element|).- If require well-formed is true, and attr's [=Attr/value=] is the - XMLNS namespace, then throw an exception; the serialization of this - attribute would produce invalid XML because the XMLNS namespace is reserved and - cannot be applied as an element's namespace via XML parsing. + XMLNS namespace, then [=throw an exception=]. + The serialization of this attribute would produce invalid XML + because the XMLNS namespace is reserved and cannot be applied as an + element's namespace via XML parsing.
DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.
- If require well-formed is true, and attr's [=Attr/value=] is the - empty string, then throw an exception; namespace prefix declarations cannot be used - to undeclare a namespace (use a default namespace declaration instead). + empty string, then [=throw an exception=]. + Namespace prefix declarations cannot be used to undeclare a + namespace (use a default namespace declaration instead).
- If |prefix| is "
xmlns", then set candidate prefix to "xmlns".- Otherwise, attribute namespace in not the XMLNS namespace. Run - these steps: +
- Otherwise (attribute namespace is not the XMLNS namespace):
- Set candidate prefix to the result of generating a prefix given map, attribute namespace, and prefix index. @@ -1014,8 +1037,8 @@
Extensibility
- If require well-formed is true, and attr's [=Attr/local name=] contains the character "
:" (U+003A COLON) or does not match the XML Name production or equals "xmlns" and attribute namespace is null, then - throw an exception; the serialization of attr would not be a - well-formed attribute. + throw an exception. + The serialization of attr would not be well-formed.- Append the following to result, in the order listed:
@@ -1040,13 +1063,14 @@
Extensibility
- If require well-formed is true, and attribute value contains characters that are not matched by the XML Char - production, then throw an exception; the serialization of attribute value - would fail to produce a well-formed element serialization. + production, then throw an exception. + The serialization of attribute value would not be + well-formed.
- If attribute value is null, then return the empty string. -
- Otherwise, attribute value is a string. Return attribute value, first - replacing any occurrences of the following: +
- Otherwise, return attribute value, first replacing any occurrences of the + following:
- "
&" with "&" @@ -1101,8 +1125,8 @@Extensibility
- If require well-formed is true, and node's [=document element=] is - null, then throw an exception; the serialization of node would not be a - well-formed document. + null, then throw an exception. + The serialization of node would not be well-formed.
- Otherwise:
@@ -1140,8 +1164,8 @@
Extensibility
- If require well-formed is true, and node's [=CharacterData/data=] contains characters that are not matched by the XML Char production or contains "
--" (two adjacent U+002D HYPHEN-MINUS characters) or ends with a - "-" (U+002D HYPHEN-MINUS) character, then throw an exception; the - serialization of node's [=CharacterData/data=] would not be well-formed. + "-" (U+002D HYPHEN-MINUS) character, then throw an exception. + The serialization of node would not be well-formed.- Otherwise, return the concatenation of "
<!--", node's [=CharacterData/data=], and "-->". @@ -1184,8 +1208,8 @@Extensibility
- If require well-formed is true, and node's [=CharacterData/data=] contains characters that are not matched by the XML Char production, then - throw an exception; the serialization of node's [=CharacterData/data=] - would not be well-formed. + throw an exception. + The serialization of node would not be well-formed.
- Let markup be node's [=CharacterData/data=]. @@ -1245,14 +1269,14 @@
Extensibility
- If require well-formed is true, and node's [=DocumentType/public ID=] contains characters that are not matched by the XML PubidChar production, then - throw an exception; the serialization of node would not be a well-formed - document type declaration. + throw an exception. + The serialization of node would not be well-formed.
- If require well-formed is true, and node's [=DocumentType/system ID=] contains characters that are not matched by the XML Char production or that contains both a "
"" (U+0022 QUOTATION MARK) and a "'" (U+0027 APOSTROPHE), - then throw an exception; the serialization of node would not be a - well-formed document type declaration. + then throw an exception. + The serialization of node would not be well-formed.- Let markup be the empty string. @@ -1260,8 +1284,9 @@
Extensibility
- Append "
" (U+0020 SPACE) to markup. -- Append node's [=DocumentType/name=] to markup. For a node - belonging to an HTML document, the value will be all lowercase. +
- Append node's [=DocumentType/name=] to markup. + For a node belonging to an HTML document, the + name will be all lowercase.
- If node's [=DocumentType/public ID=] is not the empty string, then append the following, in the order listed, to markup: @@ -1339,14 +1364,14 @@
Extensibility
- If require well-formed is true, and node's [=ProcessingInstruction/target=] contains a "
:" (U+003A COLON) character or is an ASCII case-insensitive match for "xml", then - throw an exception; the serialization of node's - [=ProcessingInstruction/target=] would not be well-formed. + throw an exception. + The serialization of node would not be well-formed.- If require well-formed is true, and node's [=CharacterData/data=] contains characters that are not matched by the XML Char production or contains "
?>" (U+003F QUESTION MARK, - U+003E GREATER-THAN SIGN), then throw an exception; the serialization of - node's [=CharacterData/data=] would not be well-formed. + U+003E GREATER-THAN SIGN), then throw an exception. + The serialization of node would not be well-formed.- Let markup be the concatenation of the following, in the order listed:
From c0f24126df647af44a1fb386cc9e6ddfe5b9d5dc Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:48:01 +0200 Subject: [PATCH 57/67] Editorial: Reduce duplication in 'XML serialization of the attributes' --- index.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index caf8ce4..be2f4b6 100644 --- a/index.html +++ b/index.html @@ -938,15 +938,16 @@ Extensibility
- [=list/For each=] attr of element's [=Element/attribute list=]:
-
- If require well-formed is true, and localname set contains a tuple - whose values match those of a new tuple consisting of attr's [=Attr/namespace=] and - [=Attr/local name=], then throw an exception; the serialization of - attr would fail to produce a well-formed element serialization. +
- Let attribute namespace be attr's [=Attr/namespace=]. -
- Create a new tuple consisting of attr's [=Attr/namespace=] and - [=Attr/local name=], and add it to localname set. +
- Let |attrName| be a new tuple (|attribute namespace|, attr's + [=Attr/local name=]). -
- Let attribute namespace be attr's [=Attr/namespace=]. +
- If require well-formed is true, and localname set [=set/contains=] + |attrName|, then throw an exception. The serialization of + attr would not be well-formed. + +
- [=set/Append=] |attrName| to localname set.
- Let candidate prefix be null. From 770807cbc366e7b61f7e3524abbe6334d1ac4076 Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:48:02 +0200 Subject: [PATCH 58/67] Editorial: Clarify signature of 'serializing an attribute value' --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index be2f4b6..3737cb1 100644 --- a/index.html +++ b/index.html @@ -1058,7 +1058,7 @@ Extensibility
-+ +When serializing an attribute value given an attribute value and a +
When serializing an attribute value given a string or null |attribute value| and a boolean require well-formed, run the following steps:
From d72e8ca603a1e03985e154f3ff0b5a5f35f42356 Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 00:48:02 +0200 Subject: [PATCH 59/67] Editorial: Reduce duplication in 'XML serializing a Text node' --- index.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 3737cb1..c2078f3 100644 --- a/index.html +++ b/index.html @@ -1207,13 +1207,12 @@ Extensibility
must run the following steps:-
- If require well-formed is true, and node's [=CharacterData/data=] - contains characters that are not matched by the XML Char production, then - throw an exception. - The serialization of node would not be well-formed. -
- Let markup be node's [=CharacterData/data=]. +
- If require well-formed is true, and markup contains characters that + are not matched by the XML Char production, then throw an exception. + The serialization of node would not be well-formed. +
- Replace any occurrences of "
&" in markup by "&". From dbaa86a0a38f5b4909bcb1f261ca043a91d40f50 Mon Sep 17 00:00:00 2001 From: Ms2gerDate: Mon, 17 Aug 2026 00:48:03 +0200 Subject: [PATCH 60/67] Editorial: Add references to some GitHub issues --- index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.html b/index.html index c2078f3..d45bad7 100644 --- a/index.html +++ b/index.html @@ -525,6 +525,8 @@ Extensibility
does not map to the correct namespace, as the retrieving a preferred prefix string algorithm already tried to match the existing prefix. + +
- Append the concatenation of candidate prefix, "
:" (U+003A COLON), and node's [=Element/local name=] to qualified name. @@ -1108,6 +1110,8 @@Extensibility
Extensibility
- "
"" (U+0022 QUOTATION MARK).- {{Text}}
- Run the algorithm for XML serializing a Text node given |node| and @@ -1196,7 +1196,6 @@
Extensibility
-XML serializing a Text node
From ff57e006d01b919d536e31554b753fd7944cd3c3 Mon Sep 17 00:00:00 2001 From: Ms2gerDate: Mon, 17 Aug 2026 00:48:29 +0200 Subject: [PATCH 66/67] Normative: Excape tab, LF, CR in attributes Fixes #59. --- index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index a7655d8..204a9e4 100644 --- a/index.html +++ b/index.html @@ -1098,7 +1098,11 @@ Extensibility
- "
<" with "<" -- "
>" with ">" +- U+0009 CHARACTER TABULATION with "
	" + +- U+000A LINE FEED (LF) with "

" + +- U+000D CARRIAGE RETURN (CR) with "

"This matches behavior present in browsers, and goes above and beyond the grammar requirement in the XML specification's AttValue production by also replacing From 83c42baf3d739c93e1bd2753efadfc17bd07cf24 Mon Sep 17 00:00:00 2001 From: Ms2ger
Date: Mon, 17 Aug 2026 15:28:15 +0200 Subject: [PATCH 67/67] Normative: Adjust quote character for DocumentTypes This does not solve all potential issues: if there it both a double and a single quote in the ID, there is no valid representation. However, this change allows round-tripping parsable XML, and matches Firefox's behavior. Fixes #71. --- index.html | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 204a9e4..ff2a9b4 100644 --- a/index.html +++ b/index.html @@ -1318,11 +1318,7 @@ Extensibility
- "
" (U+0020 SPACE); -- "
"" (U+0022 QUOTATION MARK); - -- node's [=DocumentType/public ID=]; - -
- "
"" (U+0022 QUOTATION MARK). +- the [=serialization of the ID=] node's [=DocumentType/public ID=].
- If node's [=DocumentType/system ID=] is not the empty string and @@ -1339,13 +1335,8 @@
Extensibility
-
- "
" (U+0020 SPACE); -- "
"" (U+0022 QUOTATION MARK); - -- node's [=DocumentType/system ID=]; - -
- "
"" (U+0022 QUOTATION MARK). +- the [=serialization of the ID=] node's [=DocumentType/system ID=].
XML serializing a ProcessingInstruction node