From dea06d0caf71f9ac48a38f287549b5cb6711bef6 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:44 +0200 Subject: [PATCH 01/67] Editorial: Fix Respec warnings --- index.html | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/index.html b/index.html index fdd3efa..d8705ec 100644 --- a/index.html +++ b/index.html @@ -59,7 +59,7 @@

Candidate Recommendation Exit Criteria

Report. -
+

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 @@

Candidate Recommendation Exit Criteria

propagated up to its caller.
-
+

Extensibility

Vendor-specific proprietary extensions to this specification are strongly discouraged. Authors @@ -102,7 +102,7 @@

Extensibility

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.

@@ -187,9 +187,6 @@

Extensibility

-

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 @@

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

- - The Web IDL [[WebIDL]] specification defines: - -
From 3ab87e492e9bf95d3401ee6c046fe96f88f393c3 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:45 +0200 Subject: [PATCH 02/67] Editorial: Update the Respec configuration --- respecConfig.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/respecConfig.js b/respecConfig.js index 5700f99..9b698cd 100644 --- a/respecConfig.js +++ b/respecConfig.js @@ -7,7 +7,7 @@ var respecConfig = { { name: "Travis Leithead", company: "Microsoft", mailto: "travis.leithead@microsoft.com", companyURL: "http://www.microsoft.com", w3cid: "40117" } ], edDraftURI: "https://w3c.github.io/DOM-Parsing/", - xref: ["webidl", "html"], + xref: "web-platform", //format: "markdown", shortName: "DOM-Parsing", wg: ["Web Platform Working Group"], @@ -17,16 +17,14 @@ var respecConfig = { wgPublicList: "www-dom", wgPatentURI: ["https://www.w3.org/2004/01/pp-impl/83482/status"], subjectPrefix: "DOM-Parsing", + github: "w3c/DOM-Parsing", otherLinks: [{ key: "Test Suites", data: [ - { href: "http://w3c-test.org/domparsing/" }, - { href: "http://w3c-test.org/html/syntax/" } + { href: "http://wpt.live/domparsing/" }, + { href: "http://wpt.live/html/syntax/" } ]}, { key: "Participate", data: [ - { value: 'We are on Github.', href: 'https://github.com/w3c/DOM-Parsing' }, - { value: 'Bugzilla Bug list.', href: 'https://www.w3.org/Bugs/Public/buglist.cgi?component=DOM%20Parsing%20and%20Serialization&list_id=44989&product=WebAppsWG&resolution=---' }, - { value: 'Github Issues.', href: 'https://github.com/w3c/DOM-Parsing/issues' }, - { value: 'Commit history.', href: 'https://github.com/w3c/DOM-Parsing/commits' }, + { value: 'Bugzilla Bug list.', href: 'https://www.w3.org/Bugs/Public/buglist.cgi?component=DOM%20Parsing%20and%20Serialization&list_id=44989&product=WebAppsWG&resolution=---' }, { value: 'Mailing list.', href: 'http://lists.w3.org/Archives/Public/www-dom/' } ]} ] From c08e2f65fbc6f092035d55df2d9c81268cc1165c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:46 +0200 Subject: [PATCH 03/67] Editorial: Fix minor typos Fixes #72. --- index.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index d8705ec..5510e22 100644 --- a/index.html +++ b/index.html @@ -489,7 +489,7 @@

Extensibility

prefix attribute.
  • Let candidate prefix be the result of - retrieving a preferred prefix string prefix from map given + retrieving a preferred prefix string prefix from map given namespace ns.

    The above may return null if no namespace key ns exists @@ -591,8 +591,8 @@

    Extensibility

    to ns, then:

    At this point, the namespace for this node still needs to be serialized, but - there's no 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 @@

      Extensibility

      inherited ns, map, prefix index, and the require well-formed flag. -

      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.

    1. Otherwise, append to markup the result of running the @@ -951,7 +951,7 @@

      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). -
    2. the attr's prefix matches the string +
    3. If the attr's prefix matches the string "xmlns", then let candidate prefix be the string "xmlns".
    @@ -1113,7 +1113,7 @@

    Extensibility

    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 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:
      -
    1. Let markup the empty string. +
    2. Let markup be the empty string.
    3. For each child child of node, in tree order, run the XML serialization algorithm on the child given namespace, From 99f6a9b978da9527089089574d0363b9a8729072 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:46 +0200 Subject: [PATCH 04/67] Normative: Don't use 'should' --- index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 5510e22..e23804a 100644 --- a/index.html +++ b/index.html @@ -439,7 +439,7 @@

      Extensibility

      represented by the empty string).

      This map is local to each element. It is used to ensure there are no conflicting - prefixes should a new namespace 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

      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:

      1. Let candidates list be the result of retrieving a list from map @@ -842,7 +842,7 @@

        Extensibility

      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:

      1. Let candidates list be the result of retrieving a list from map @@ -854,7 +854,7 @@

        Extensibility

      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:

      1. Let candidates list be the result of retrieving a list from map @@ -936,7 +936,7 @@

        Extensibility

      2. the attr's 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);
      3. the attr's prefix is not null and either
          From 553f3284f3b0b3ccc269ad687e7a3717d534678a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:46 +0200 Subject: [PATCH 05/67] Editorial: Don't use 'may' --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index e23804a..8098577 100644 --- a/index.html +++ b/index.html @@ -492,7 +492,7 @@

          Extensibility

          retrieving a preferred prefix string prefix from map given namespace ns. -

          The above may return null if no namespace key ns exists +

          The above can return null if no namespace key ns exists in map.

        • If the value of prefix matches "xmlns", then run the following @@ -510,7 +510,7 @@

          Extensibility

        • Found a suitable namespace prefix: if candidate prefix is not null (a namespace prefix is defined which maps to ns), then: -

          The following may serialize a different +

          The following can serialize a different 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

          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).

      From 4d9ae7d2b692f321ad1294a9aeb6c9a633cf6adc Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:47 +0200 Subject: [PATCH 06/67] Editorial: Explicitly depend on the Infra standard --- index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.html b/index.html index 8098577..56297cb 100644 --- a/index.html +++ b/index.html @@ -60,6 +60,8 @@

      Candidate Recommendation Exit Criteria

  • +

    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 Date: Mon, 17 Aug 2026 00:47:47 +0200 Subject: [PATCH 07/67] Editorial: Remove redundant definitions of namespaces These can be used directly from Infra --- index.html | 9 --------- 1 file changed, 9 deletions(-) diff --git a/index.html b/index.html index 56297cb..2ad71c1 100644 --- a/index.html +++ b/index.html @@ -189,15 +189,6 @@

    Extensibility

    -

    The following terms are understood to represent their respective namespaces in this - specification (and makes it easier to read): - -

      -
    • The HTML namespace is http://www.w3.org/1999/xhtml -
    • The XML namespace is http://www.w3.org/XML/1998/namespace -
    • The XMLNS namespace is http://www.w3.org/2000/xmlns/ -
    -

    APIs for parsing and serializing DOM

    From 196d2c76707082f57b19df9f3369370634b48f66 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:47 +0200 Subject: [PATCH 08/67] Editorial: Consistently use 'the empty string' --- index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 2ad71c1..5bfeb61 100644 --- a/index.html +++ b/index.html @@ -318,7 +318,7 @@

    Extensibility

    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 an empty string. + Attr object will result in the empty string.

    To produce an XML serialization of a Node node given a flag require well-formed, run the following steps: @@ -393,7 +393,7 @@

    Extensibility

    Run the algorithm for XML serializing a ProcessingInstruction node node.
    An Attr object -
    Return an empty string. +
    Return the empty string.
    Anything else
    Throw a TypeError. Only Nodes and Attr objects can be serialized by @@ -416,7 +416,7 @@

    Extensibility

  • Let markup be the string "<" (U+003C LESS-THAN SIGN). -
  • Let qualified name be an empty string. +
  • Let qualified name be the empty string.
  • Let skip end tag be a boolean flag with value false. @@ -1082,7 +1082,7 @@

    Extensibility

    Otherwise, run the following steps:

      -
    1. Let serialized document be an empty string. +
    2. Let serialized document be the empty string.
    3. For each child child of node, in tree order, run the XML serialization algorithm on the child passing along the provided arguments, @@ -1194,7 +1194,7 @@

      Extensibility

      "'" (U+0027 APOSTROPHE), then throw an exception; the serialization of this node would not be a well-formed document type declaration. -
    4. Let markup be an empty string. +
    5. Let markup be the empty string.
    6. Append the string "<!DOCTYPE" to markup. From a2412966b1cfc46ca883b3f87777a811dff66aef Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:48 +0200 Subject: [PATCH 09/67] Editorial: Fix mis-nested algorithm step in 'XML serializing an Element node' Fixes #43. --- index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 5bfeb61..e130a4f 100644 --- a/index.html +++ b/index.html @@ -570,13 +570,13 @@

      Extensibility

      require well-formed flag as input;
    7. """ (U+0022 QUOTATION MARK). - -
    8. If local default namespace is not 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.
    + +
  • If local default namespace is not 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.
  • Otherwise, if local default namespace is null, or From a0a410001b30f74fc4d34f69f771d7e12647bf3c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:48 +0200 Subject: [PATCH 10/67] Editorial: Remove code markup for null, true and false --- index.html | 112 ++++++++++++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/index.html b/index.html index e130a4f..a90d2fd 100644 --- a/index.html +++ b/index.html @@ -324,12 +324,12 @@

    Extensibility

    a flag require well-formed, run the following steps:
      -
    1. Let namespace be a context namespace with value null. +
    2. 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 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 - (null) to start. + (null) to start.
    3. Let prefix map be a new namespace prefix map. @@ -408,7 +408,7 @@

      Extensibility

      follows:
        -
      1. If the require well-formed flag is set (its value is true), +
      2. If the require well-formed flag is set (its value is true), and this node's 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

      3. Let qualified name be the empty string. -
      4. Let skip end tag be a boolean flag with value false. +
      5. Let skip end tag be a boolean flag with value false.
      6. Let ignore namespace definition attribute be a boolean flag with value - false. + false.
      7. Given prefix map, copy a namespace prefix map and let map be the result.
      8. Let local prefixes map be an empty map. The map has unique Node 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).

        This map is local to each element. It is used to ensure there are no conflicting @@ -447,7 +447,7 @@

        Extensibility

        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 null.

        + exists. Otherwise it returns null.

      9. Let inherited ns be a copy of namespace. @@ -456,8 +456,8 @@

        Extensibility

      10. If inherited ns is equal to ns, then:
          -
        1. If local default namespace is not null, then set - ignore namespace definition attribute to true. +
        2. If local default namespace is not null, then set + ignore namespace definition attribute to true.
        3. If ns is the XML namespace, then append to qualified name the concatenation of the string "xml:" and the @@ -485,7 +485,7 @@

          Extensibility

          retrieving a preferred prefix string prefix from map given namespace ns. -

          The above can return null if no namespace key ns exists +

          The above can return null if no namespace key ns exists in map.

        4. If the value of prefix matches "xmlns", then run the following @@ -501,7 +501,7 @@

          Extensibility

          matches the node's namespaceURI. This prefix will be used in serialization even if the node doesn't have a real prefix. -->
        5. Found a suitable namespace prefix: if candidate prefix is not - 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 @@

          Extensibility

          node's ancestry a namespace prefix definition that defines the node's namespace. -
        6. If the local default namespace is not null (there exists +
        7. If the 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 the local default namespace is the empty string in which case let it get - 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 @@

          Extensibility

        8. Append the value of qualified name to markup.
        -
      11. Otherwise, if prefix is not null, then: +
      12. 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 @@ -572,15 +572,15 @@

        Extensibility

      13. """ (U+0022 QUOTATION MARK).
      -
    4. If local default namespace is not null (there exists a +
    5. If local default namespace is not 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. + it get null.
    -
  • Otherwise, if local default namespace is null, or - local default namespace is not null and its value is not equal +
  • Otherwise, if local default namespace is null, or + local default namespace is not null and its value is not equal to ns, then:

    At this point, the namespace for this node still needs to be serialized, but @@ -590,7 +590,7 @@

    Extensibility

    1. Set the ignore namespace definition attribute flag to - true. + true.
    2. Append to qualified name the value of node's localName. @@ -667,15 +667,15 @@

      Extensibility

    3. "/" (U+002F SOLIDUS).
    - and set the skip end tag flag to true. + and set the skip end tag flag to true.
  • If ns is not the HTML namespace, and the node's list of children is empty, then append "/" (U+002F SOLIDUS) to markup - and set the skip end tag flag to true. + and set the skip end tag flag to true.
  • Append ">" (U+003E GREATER-THAN SIGN) to markup. -
  • If the value of skip end tag is true, then return the value of +
  • If the value of skip end tag is true, then return the value of markup and skip the remaining steps. The node is a leaf-node.
  • If ns is the HTML namespace, and the node's @@ -711,7 +711,7 @@

    Extensibility

    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.

    + 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 @@

    Extensibility

    steps:
      -
    1. Let default namespace attr value be null. +
    2. Let default namespace attr value be null.
    3. Main: For each attribute attr in element's attributes, in the order they are specified in the element's @@ -739,12 +739,12 @@

      Extensibility

    4. If the attribute namespace is the XMLNS namespace, then:
        -
      1. If attribute prefix is null, then attr is a default +
      2. If attribute prefix is null, then attr is a default namespace declaration. Set the default namespace attr value to attr's value and stop running these steps, returning to Main to visit the next attribute. -
      3. Otherwise, the attribute prefix is not null and attr +
      4. Otherwise, the attribute prefix is not null and attr is a namespace prefix definition. Run the following steps:
        1. Let prefix definition be the value of attr's @@ -762,7 +762,7 @@

          Extensibility

          if necessary) the element's localname with the reserved "xml" prefix.

        2. If namespace definition is the empty string (the declarative form of - having no namespace), then let namespace definition be null + having no namespace), then let namespace definition be null instead.
        3. If prefix definition is found in map given the namespace @@ -778,14 +778,14 @@

          Extensibility

        4. Add the value of prefix definition as a new key to the local prefixes map, with the namespace definition as the - key's value replacing the value of null with the empty string if applicable. + key's value replacing the value of null with the empty string if applicable.
  • Return the value of default namespace attr value.

    The empty string is a legitimate return value and is not converted to - null.

    + null.

  • @@ -794,7 +794,7 @@

    Extensibility

    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 @@

    Extensibility

    1. 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. + is no such key, then stop running these steps, and return the null value.
    2. Otherwise, for each prefix value prefix in candidates list, iterating from beginning to end: @@ -840,10 +840,10 @@

      Extensibility

      1. 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. + is no such key, then stop running these steps, and return false.
      2. If the value of prefix occurs at least once in candidates list, return - true, otherwise return false. + true, otherwise return false.

      To add a prefix string prefix to the namespace prefix map @@ -852,9 +852,9 @@

      Extensibility

      1. 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. + is no such key, then let candidates list be null. -
      2. If candidates list is null, then create a new list with +
      3. 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. @@ -891,7 +891,7 @@

        Extensibility

        attributes, in the order they are specified in the element's attribute list:
          -
        1. If the require well-formed flag is set (its value is true), and the +
        2. If the require well-formed flag is set (its value is true), and the localname set contains a tuple whose values match those of a new tuple consisting of attr's namespaceURI attribute and localName attribute, then throw an exception; the serialization of @@ -905,9 +905,9 @@

          Extensibility

          namespaceURI value. -
        3. Let candidate prefix be null. +
        4. Let candidate prefix be null. -
        5. If attribute namespace is not null, then run these sub-steps: +
        6. If attribute namespace is not null, then run these sub-steps:
          1. Let candidate prefix be the result of retrieving a preferred prefix string from map given namespace @@ -927,11 +927,11 @@

            Extensibility

            problem, this algorithm always prefixes elements in the XML namespace with "xml" and drops any related definitions as seen in the above condition.

            -
          2. the attr's prefix is null and the - ignore namespace definition attribute flag is true (the +
          3. the attr's prefix is null and the + ignore namespace definition attribute flag is true (the Element's default namespace attribute is to be skipped); -
          4. the attr's prefix is not null and either +
          5. the attr's prefix is not null and either
            • the attr's localName is not a key contained in the local prefixes map, or @@ -948,7 +948,7 @@

              Extensibility

              element whose attributes are being processed).
            -
          6. If the require well-formed flag is set (its value is true), and +
          7. If the require well-formed flag is set (its value is true), and the value of 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 @@ -957,7 +957,7 @@

            Extensibility

            DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.

            -
          8. If the require well-formed flag is set (its value is true), and +
          9. If the require well-formed flag is set (its value is true), and the value of attr's value attribute is the empty string, then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). @@ -993,13 +993,13 @@

            Extensibility

          10. Append a " " (U+0020 SPACE) to result. -
          11. If candidate prefix is not null, then append to result +
          12. If candidate prefix is not null, then append to result the concatenation of candidate prefix with ":" (U+003A COLON). -
          13. If the require well-formed flag is set (its value is true), and this +
          14. If the require well-formed flag is set (its value is true), and this attr's 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 @@

            Extensibility

            require well-formed flag, the user agent must run the following steps:
              -
            1. If the require well-formed flag is set (its value is true), and +
            2. If the require well-formed flag is set (its value 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 would fail to produce a well-formed element serialization. -
            3. If attribute value is null, then return the empty string. +
            4. If attribute value is null, then return the empty string.
            5. Otherwise, attribute value is a string. Return the value of attribute value, first replacing any occurrences of the following: @@ -1074,9 +1074,9 @@

              Extensibility

              The algorithm for producing an XML serialization of a DOM node of type Document is as follows: -

              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 @@

              Extensibility

              The algorithm for producing an XML serialization of a DOM node of type Comment is as follows: -

              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 @@

              Extensibility

              follows:
                -
              1. If the require well-formed flag is set (its value is true), and +
              2. 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, then throw an exception; the serialization of this node's data would not be well-formed. @@ -1183,12 +1183,12 @@

                Extensibility

                is as follows:
                  -
                1. If the require well-formed flag is true and the node's +
                2. If the require well-formed flag is 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. -
                3. If the require well-formed flag is true and the node's +
                4. If the require well-formed flag is 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 @@

                  Extensibility

                  ProcessingInstruction is as follows:
                    -
                  1. If the require well-formed flag is set (its value is true), and +
                  2. If the require well-formed flag is set (its value is true), and node's 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. -
                  3. If the require well-formed flag is set (its value is true), and +
                  4. 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 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 Date: Mon, 17 Aug 2026 00:47:48 +0200 Subject: [PATCH 11/67] Editorial: Mark up 'Recording the namespace' as an algorithm --- index.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index a90d2fd..2623e63 100644 --- a/index.html +++ b/index.html @@ -708,15 +708,15 @@

                    Extensibility

                    Recording the namespace

                    +

                    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:

                    1. Let default namespace attr value be null. @@ -777,7 +777,7 @@

                      Extensibility

                      namespace definition.
                    2. Add the value of prefix definition as a new key to the - local prefixes map, with the namespace definition as the + local prefixes map, with the namespace definition as the key's value replacing the value of null with the empty string if applicable.
                  @@ -787,6 +787,7 @@

                  Extensibility

                  The empty string is a legitimate return value and is not converted to null.

                +
    From aa617be1e0ce8ab5deca90e4718f964a2bd6b0b1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:48 +0200 Subject: [PATCH 12/67] Editorial: Mark up the 'namespace prefix map' steps as algorithms --- index.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 2623e63..e6125b9 100644 --- a/index.html +++ b/index.html @@ -807,11 +807,14 @@

    Extensibility

    copy a namespace prefix map and retrieve a preferred prefix string for additional details.

    +

    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 @@

    Extensibility

    these steps and return prefix. +
    +

    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 @@

    Extensibility

  • If the value of prefix occurs at least once in candidates list, 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: @@ -862,10 +869,11 @@

    Extensibility

  • 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).

    + 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).

    +
  • From cdfc45eadebc7bcf49ee5d44b0dcc756bdb3694e Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:49 +0200 Subject: [PATCH 13/67] Editorial: Mark up each node type serialization steps as an algorithm --- index.html | 253 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 151 insertions(+), 102 deletions(-) diff --git a/index.html b/index.html index e6125b9..eb51ae6 100644 --- a/index.html +++ b/index.html @@ -324,91 +324,103 @@

    Extensibility

    a flag require well-formed, run the following steps:
      -
    1. Let namespace be a context namespace with value null. +
    2. 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 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 (null) to start. -
    3. Let prefix map be a new namespace prefix map. +
    4. Let prefix map be a new namespace prefix map.
    5. Add the XML namespace with prefix value "xml" to - prefix map. + prefix map. -
    6. Let prefix index be a generated namespace prefix index with value +
    7. 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 namespaceURI (or the namespaceURI of one of node's attributes). See the generate a prefix algorithm. -
    8. Return the result of running the XML serialization algorithm on node - passing the context namespace namespace, namespace prefix map - prefix map, generated namespace prefix index reference to - prefix index, and the flag require well-formed. If an +
    9. Return the result of running the XML serialization algorithm given node, + namespace, prefix map, generated namespace prefix index reference + to prefix index, and the flag require well-formed. If an exception occurs during the execution of the algorithm, then catch that exception and throw an "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 -
    Run the algorithm for XML serializing an Element node node. +
      +
    1. If node's interface is:

      -
      Document -
      Run the algorithm for XML serializing a Document node node. +
      +
      {{Element}} +
      Run the algorithm for XML serializing an Element node given |node|, |namespace|, + |namespace prefix map|, |prefix index| and require well-formed. -
      Comment -
      Run the algorithm for XML serializing a Comment node node. +
      {{Document}} +
      Run the algorithm for XML serializing a Document node given |node|, |namespace|, + |namespace prefix map|, |prefix index| and require well-formed. - +
      {{Comment}} +
      Run the algorithm for XML serializing a Comment node given |node| and + require well-formed. -
      Text -
      Run the algorithm for XML serializing a Text node node. + -
      DocumentFragment -
      Run the algorithm for XML serializing a DocumentFragment node node. +
      {{Text}} +
      Run the algorithm for XML serializing a Text node given |node| and + require well-formed. -
      DocumentType -
      Run the algorithm for XML serializing a DocumentType node node. +
      {{DocumentFragment}} +
      Run the algorithm for XML serializing a DocumentFragment node given |node|, + |namespace|, |namespace prefix map|, |prefix index| and require well-formed. -
      ProcessingInstruction -
      Run the algorithm for XML serializing a ProcessingInstruction node node. +
      {{DocumentType}} +
      Run the algorithm for XML serializing a DocumentType node given |node| and + require well-formed. -
      An Attr object -
      Return the empty string. +
      {{ProcessingInstruction}} +
      Run the algorithm for XML serializing a ProcessingInstruction node given |node| and + require well-formed. -
      Anything else -
      Throw a TypeError. Only Nodes and Attr objects can be serialized by - this algorithm. -
      +
      {{Attr}} +
      Return the empty string. +
      Anything else +
      Throw a {{TypeError}}. Only {{Node}}s and {{Attr}}s can be serialized by this algorithm. +
    + +
    Each of the above referenced algorithms are detailed in the sections that follow. -

    XML serializing an Element node

    +

    XML serializing an Element node

    - The algorithm for producing an XML serialization of a DOM node of type Element is as - follows: +
    +

    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:

      -
    1. If the require well-formed flag is set (its value is true), +
    2. If the require well-formed flag is set (its value is true), and this node's 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 @@

      Extensibility

    3. Let ignore namespace definition attribute be a boolean flag with value false. -
    4. Given prefix map, copy a namespace prefix map and let +
    5. Given prefix map, copy a namespace prefix map and let map be the result.
    6. Let local prefixes map be an empty map. The map has unique Node @@ -449,7 +461,7 @@

      Extensibility

      return a local default namespace value defined by a default namespace attribute if one exists. Otherwise it returns null.

      -
    7. Let inherited ns be a copy of namespace. +
    8. Let inherited ns be a copy of namespace.
    9. Let ns be the value of node's namespaceURI attribute. @@ -491,7 +503,7 @@

      Extensibility

    10. If the value of prefix matches "xmlns", then run the following steps:
        -
      1. If the require well-formed flag is set, then throw an error. An +
      2. If the require well-formed flag is set, then throw an error. An Element with prefix "xmlns" will not legally round-trip in a conforming XML parser. @@ -543,7 +555,7 @@

        Extensibility

        1. If the local prefixes map contains a key matching prefix, then let prefix be the result of generating a prefix providing as input - map, ns, and prefix index. + map, ns, and prefix index.
        2. Add prefix to map given namespace ns. @@ -567,7 +579,7 @@

          Extensibility

        3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
        4. The result of serializing an attribute value given ns and the - require well-formed flag as input; + require well-formed flag as input;
        5. """ (U+0022 QUOTATION MARK).
        @@ -616,7 +628,7 @@

        Extensibility

      3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
      4. The result of serializing an attribute value given ns and the - require well-formed flag as input; + require well-formed flag as input;
      5. """ (U+0022 QUOTATION MARK).
      @@ -635,9 +647,9 @@

      Extensibility

    11. Append to markup the result of the XML serialization of node's attributes - given map, prefix index, local prefixes map, + given map, prefix index, local prefixes map, ignore namespace definition attribute flag, and - require well-formed flag. + require well-formed flag.
    12. If ns is the HTML namespace, and the node's list of children is empty, and the node's localName matches any @@ -682,17 +694,17 @@

      Extensibility

      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.

    13. Otherwise, append to markup the result of running the XML serialization algorithm on each of node's children, in - tree order, providing inherited ns, map, - prefix index, and the require well-formed flag. + tree order, given the child, inherited ns, map, + prefix index, and the require well-formed flag.
    14. Append the following to markup, in the order listed:
        @@ -705,6 +717,7 @@

        Extensibility

      1. Return the value of markup.
      +

    Recording the namespace

    @@ -1078,12 +1091,19 @@

    Extensibility

    -

    XML serializing a Document node

    +

    XML serializing a Document node

    - The algorithm for producing an XML serialization of a DOM node of type Document is - as follows: - -

    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 @@

    Extensibility

  • Let serialized document be the empty string.
  • For each child child of node, in tree order, run the - XML serialization algorithm on the child passing along the provided arguments, - and append the result to serialized document. + XML serialization algorithm given child, inherited ns, + map, prefix index, and require well-formed, and append the + result to serialized document.

    This will serialize any number of ProcessingInstruction and Comment nodes both before and after the Document's documentElement node, including @@ -1104,15 +1125,20 @@

    Extensibility

  • Return the value of serialized document. +
  • -

    XML serializing a Comment node

    +

    XML serializing a Comment node

    - The algorithm for producing an XML serialization of a DOM node of type Comment is as - follows: +
    +

    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 @@

    Extensibility

    Otherwise, return the concatenation of "<!--", node's data, and "-->". +

    -

    XML serializing a Text node

    +

    XML serializing a Text node

    - The algorithm for producing an XML serialization of a DOM node of type Text is as - follows: +
    +

    The algorithm for XML serializing a Text node, given + a {{Text}} |node:Text|, + and + a require well-formed flag, + must run the following steps:

      -
    1. If the require well-formed flag is set (its value is true), and +
    2. 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, then throw an exception; the serialization of this node's data would not be well-formed. @@ -1165,39 +1201,52 @@

      Extensibility

    3. Return the value of markup.
    +
    -

    XML serializing a DocumentFragment node

    +

    XML serializing a DocumentFragment node

    - The algorithm for producing an XML serialization of a DOM node of type - DocumentFragment is as follows: +
    +

    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:

    1. Let markup be the empty string.
    2. For each child child of node, in tree order, run the - XML serialization algorithm on the child given namespace, - prefix map, a reference to prefix index, and flag - require well-formed. Concatenate the result to markup. + XML serialization algorithm given child, namespace, + prefix map, a reference to prefix index, and flag + require well-formed. Concatenate the result to markup.
    3. Return the value of markup.
    +
    -

    XML serializing a DocumentType node

    +

    XML serializing a DocumentType node

    - The algorithm for producing an XML serialization of a DOM node of type DocumentType - is as follows: +
    +

    The algorithm for XML serializing a DocumentType node, given + a {{DocumentType}} |node:DocumentType|, + and + a require well-formed flag, + must run the following steps:

      -
    1. If the require well-formed flag is true and the node's +
    2. If the require well-formed flag is 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. -
    3. If the require well-formed flag is true and the node's +
    4. If the require well-formed flag is 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,22 +1321,27 @@

      Extensibility

    5. Return the value of markup.
    +
    -

    XML serializing a ProcessingInstruction node

    +

    XML serializing a ProcessingInstruction node

    - The algorithm for producing an XML serialization of a DOM node of type - ProcessingInstruction is as follows: +
    +

    The algorithm for XML serializing a ProcessingInstruction node, given + a {{ProcessingInstruction}} |node:ProcessingInstruction|, + and + a require well-formed flag, + must run the following steps:

      -
    1. If the require well-formed flag is set (its value is true), and +
    2. If the require well-formed flag is set (its value is true), and node's 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. -
    3. If the require well-formed flag is set (its value is true), and +
    4. 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 the string "?>" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN), then throw an exception; the serialization of this @@ -1308,6 +1362,7 @@

      Extensibility

    5. Return the value of markup.
    +
    @@ -1395,12 +1450,6 @@

    Dependencies

    PubidChar productions
  • empty-element tag - - The ECMAScript [[ECMA-262]] (commonly "JavaScript") specification defines these terms: - -
  • From 77caa43e64d45dd6bbbec966472bea439540807a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:49 +0200 Subject: [PATCH 14/67] Editorial: Mark up the 'Serializing an Element's attributes' steps as algorithms --- index.html | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index eb51ae6..585ca52 100644 --- a/index.html +++ b/index.html @@ -892,11 +892,13 @@

    Extensibility

    Serializing an Element's attributes

    +

    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:

    1. Let result be the empty string. @@ -913,7 +915,7 @@

      Extensibility

      attributes, in the order they are specified in the element's attribute list:
        -
      1. If the require well-formed flag is set (its value is true), and the +
      2. If the require well-formed flag is set (its value is true), and the localname set contains a tuple whose values match those of a new tuple consisting of attr's namespaceURI attribute and localName attribute, then throw an exception; the serialization of @@ -950,7 +952,7 @@

        Extensibility

        "xml" and drops any related definitions as seen in the above condition.

      3. the attr's 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);
      4. the attr's prefix is not null and either @@ -964,13 +966,13 @@

        Extensibility

        and furthermore that the attr's 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). -
      5. If the require well-formed flag is set (its value is true), and +
      6. If the require well-formed flag is set (its value is true), and the value of 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 @@ -979,7 +981,7 @@

        Extensibility

        DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.

        -
      7. If the require well-formed flag is set (its value is true), and +
      8. If the require well-formed flag is set (its value is true), and the value of attr's value attribute is the empty string, then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). @@ -1006,7 +1008,7 @@

        Extensibility

      9. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
      10. The result of serializing an attribute value given attribute namespace - and the require well-formed flag as input; + and the require well-formed flag as input;
      11. """ (U+0022 QUOTATION MARK).
      @@ -1018,7 +1020,7 @@

      Extensibility

    2. If candidate prefix is not null, then append to result the concatenation of candidate prefix with ":" (U+003A COLON). -
    3. If the require well-formed flag is set (its value is true), and this +
    4. If the require well-formed flag is set (its value is true), and this attr's 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 @@

      Extensibility

    5. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
    6. The result of serializing an attribute value given attr's - value attribute and the require well-formed flag as input; + value attribute and the require well-formed flag as input;
    7. """ (U+0022 QUOTATION MARK).
  • Return the value of result. +
  • +

    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:

      -
    1. If the require well-formed flag is set (its value is true), and +
    2. If the require well-formed flag is set (its value 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 would fail to produce a well-formed element serialization. @@ -1066,6 +1070,7 @@

      Extensibility

      requirement in the XML specification's AttValue production by also replacing ">" characters.

    +
    From a0cc16ff56e1d989301c0ca15cd5c9a5a09b3a22 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:49 +0200 Subject: [PATCH 15/67] Editorial: Mark up 'generate a prefix' as an algorithm --- index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.html b/index.html index 585ca52..c421c4e 100644 --- a/index.html +++ b/index.html @@ -1076,6 +1076,7 @@

    Extensibility

    Generating namespace prefixes

    +

    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 @@

    Extensibility

  • Return the value of generated prefix. +
  • From 161b8944b4cd2a723a2671bd54386362cf1e2b94 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:49 +0200 Subject: [PATCH 16/67] Editorial: Mark up 'XML serialization' as an algorithm --- index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index c421c4e..27b2968 100644 --- a/index.html +++ b/index.html @@ -320,8 +320,9 @@

    Extensibility

    thus cannot be serialized by the XML serialization algorithm. An attempt to serialize an Attr object will result in the empty string. +

    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:

    1. Let namespace be a context namespace with value null. @@ -345,11 +346,12 @@

      Extensibility

    2. Return the result of running the XML serialization algorithm given node, namespace, prefix map, generated namespace prefix index reference - to prefix index, and the flag require well-formed. If an + to prefix index, and the flag require well-formed. If an exception occurs during the execution of the algorithm, then catch that exception and throw an "InvalidStateError" DOMException.
    +

    The XML serialization algorithm, given From 1d36ad844decf7d833a5788603f3f7bbbf51178c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:50 +0200 Subject: [PATCH 17/67] Editorial: Remove spurious dfns in 'XML serializing an Element node' --- index.html | 98 +++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/index.html b/index.html index 27b2968..4616c01 100644 --- a/index.html +++ b/index.html @@ -430,17 +430,17 @@

    Extensibility

  • Let markup be the string "<" (U+003C LESS-THAN SIGN). -
  • Let qualified name be the empty string. +
  • Let qualified name be the empty string. -
  • Let skip end tag be a boolean flag with value false. +
  • Let skip end tag be a boolean flag with value false. -
  • Let ignore namespace definition attribute be a boolean flag with value +
  • Let ignore namespace definition attribute be a boolean flag with value false.
  • Given prefix map, copy a namespace prefix map and let map be the result. -
  • Let local prefixes map be an empty map. The map has unique Node +
  • Let local prefixes map be an empty map. The map has unique Node 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.

    -
  • Let local default namespace be the result of +
  • Let local default namespace be the result of recording the namespace information for node given map and - local prefixes map. + 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 - 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.

    -
  • Let inherited ns be a copy of namespace. +
  • Let inherited ns be a copy of namespace.
  • Let ns be the value of node's namespaceURI attribute. -
  • If inherited ns is equal to ns, then: +
  • If inherited ns is equal to ns, then:
      -
    1. If local default namespace is not null, then set - ignore namespace definition attribute to true. +
    2. If local default namespace is not null, then set + ignore namespace definition attribute to true.
    3. If ns is the XML namespace, then append to - qualified name the concatenation of the string "xml:" and the + qualified name the concatenation of the string "xml:" and the value of node's localName. -
    4. Otherwise, append to qualified name the value of node's +
    5. Otherwise, append to qualified name the value of node's localName. The node's prefix if it exists, is dropped. -
    6. Append the value of qualified name to markup. +
    7. Append the value of qualified name to markup.
    -
  • Otherwise, inherited ns is not equal to ns (the node's +
  • Otherwise, inherited ns is not equal to ns (the 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 - ns. Append to qualified name the value of node's - localName, let the value of inherited ns be ns, - and append the value of qualified name to markup. +
  • Otherwise, the node has a local default namespace that matches + ns. Append to qualified name the value of node's + 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.

  • Append to markup the result of the XML serialization of node's attributes - given map, prefix index, local prefixes map, - ignore namespace definition attribute flag, and + given map, prefix index, local prefixes map, + ignore namespace definition attribute flag, and require well-formed flag.
  • If ns is the HTML namespace, and the node's list of @@ -681,15 +681,15 @@

    Extensibility

  • "/" (U+002F SOLIDUS). - and set the skip end tag flag to true. + and set the skip end tag flag to true.
  • If ns is not the HTML namespace, and the node's list of children is empty, then append "/" (U+002F SOLIDUS) to markup - and set the skip end tag flag to true. + and set the skip end tag flag to true.
  • Append ">" (U+003E GREATER-THAN SIGN) to markup. -
  • If the value of skip end tag is true, then return the value of +
  • If the value of skip end tag is true, then return the value of markup and skip the remaining steps. The node is a leaf-node.
  • If ns is the HTML namespace, and the node's @@ -697,7 +697,7 @@

    Extensibility

    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 @@

    Extensibility

  • Otherwise, append to markup the result of running the XML serialization algorithm on each of node's children, in - tree order, given the child, inherited ns, map, + tree order, given inherited ns, map, prefix index, and the require well-formed flag.
  • Append the following to markup, in the order listed:
    1. "</" (U+003C LESS-THAN SIGN, U+002F SOLIDUS); -
    2. The value of qualified name; +
    3. The value of qualified name;
    4. ">" (U+003E GREATER-THAN SIGN).
    @@ -960,10 +960,10 @@

    Extensibility

  • the attr's prefix is not null and either
    • the attr's localName is - not a key contained in the local prefixes map, or + not a key contained in the local prefixes map, or
    • the attr's 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
    and furthermore that the attr's From d8f0780e788349eb72bf4fdc736807cc975e344b Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:50 +0200 Subject: [PATCH 18/67] Editorial: Use booleans rather than flags Fixes #26. --- index.html | 99 ++++++++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/index.html b/index.html index 4616c01..ce01357 100644 --- a/index.html +++ b/index.html @@ -322,7 +322,7 @@

    Extensibility

    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:

    1. Let namespace be a context namespace with value null. @@ -346,7 +346,7 @@

      Extensibility

    2. Return the result of running the XML serialization algorithm given node, namespace, prefix map, generated namespace prefix index reference - to prefix index, and the flag require well-formed. If an + 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. @@ -360,7 +360,7 @@

      Extensibility

      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, + a boolean require well-formed, must run the following steps:
        @@ -418,11 +418,11 @@

        Extensibility

        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, + a boolean require well-formed, must run the following steps:
          -
        1. If the require well-formed flag is set (its value is true), +
        2. If require well-formed is true, and this node's 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 @@

          Extensibility

        3. Let qualified name be the empty string. -
        4. Let skip end tag be a boolean flag with value false. +
        5. Let skip end tag be false. -
        6. Let ignore namespace definition attribute be a boolean flag with value - false. +
        7. Let ignore namespace definition attribute be false.
        8. Given prefix map, copy a namespace prefix map and let map be the result. @@ -505,7 +504,7 @@

          Extensibility

        9. If the value of prefix matches "xmlns", then run the following steps:
            -
          1. If the require well-formed flag is set, then throw an error. An +
          2. If require well-formed is true, then throw an error. An Element with prefix "xmlns" will not legally round-trip in a conforming XML parser. @@ -580,8 +579,8 @@

            Extensibility

          3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); -
          4. The result of serializing an attribute value given ns and the - require well-formed flag as input; +
          5. The result of serializing an attribute value given ns and + require well-formed as input;
          6. """ (U+0022 QUOTATION MARK).
          @@ -603,8 +602,7 @@

          Extensibility

          default declaration if present.

            -
          1. Set the ignore namespace definition attribute flag to - true. +
          2. Set ignore namespace definition attribute to true.
          3. Append to qualified name the value of node's localName. @@ -629,8 +627,8 @@

            Extensibility

          4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); -
          5. The result of serializing an attribute value given ns and the - require well-formed flag as input; +
          6. The result of serializing an attribute value given ns and + require well-formed as input;
          7. """ (U+0022 QUOTATION MARK).
          @@ -650,8 +648,7 @@

          Extensibility

        10. Append to markup the result of the XML serialization of node's attributes given map, prefix index, local prefixes map, - ignore namespace definition attribute flag, and - require well-formed flag. + ignore namespace definition attribute, and require well-formed.
        11. If ns is the HTML namespace, and the node's list of children is empty, and the node's localName matches any @@ -681,11 +678,11 @@

          Extensibility

        12. "/" (U+002F SOLIDUS).
        - and set the skip end tag flag to true. + and set skip end tag to true.
      1. If ns is not the HTML namespace, and the node's list of children is empty, then append "/" (U+002F SOLIDUS) to markup - and set the skip end tag flag to true. + and set skip end tag to true.
      2. Append ">" (U+003E GREATER-THAN SIGN) to markup. @@ -697,16 +694,16 @@

        Extensibility

        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.

      3. Otherwise, append to markup the result of running the XML serialization algorithm on each of node's children, in - tree order, given inherited ns, map, - prefix index, and the require well-formed flag. + tree order, given the child, inherited ns, map, + prefix index, and require well-formed.
      4. Append the following to markup, in the order listed:
          @@ -899,8 +896,8 @@

          Extensibility

          element together with a namespace prefix map map, a 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: + a boolean ignore namespace definition attribute, and + a boolean require well-formed, is the result of the following algorithm:
          1. Let result be the empty string. @@ -917,7 +914,7 @@

            Extensibility

            attributes, in the order they are specified in the element's attribute list:
              -
            1. If the require well-formed flag is set (its value is true), and the +
            2. 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 namespaceURI attribute and localName attribute, then throw an exception; the serialization of @@ -953,8 +950,8 @@

              Extensibility

              problem, this algorithm always prefixes elements in the XML namespace with "xml" and drops any related definitions as seen in the above condition.

              -
            3. the attr's prefix is null and the - ignore namespace definition attribute flag is true (the +
            4. the attr's prefix is null and + ignore namespace definition attribute is true (the Element's default namespace attribute is to be skipped);
            5. the attr's prefix is not null and either @@ -974,7 +971,7 @@

              Extensibility

              element whose attributes are being processed). -
            6. If the require well-formed flag is set (its value is true), and +
            7. If require well-formed is true, and the value of 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 @@ -983,7 +980,7 @@

              Extensibility

              DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.

              -
            8. If the require well-formed flag is set (its value is true), and +
            9. If require well-formed is true, and the value of attr's value attribute is the empty string, then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). @@ -1010,7 +1007,7 @@

              Extensibility

            10. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
            11. The result of serializing an attribute value given attribute namespace - and the require well-formed flag as input; + and require well-formed as input;
            12. """ (U+0022 QUOTATION MARK).
            @@ -1022,7 +1019,7 @@

            Extensibility

          2. If candidate prefix is not null, then append to result the concatenation of candidate prefix with ":" (U+003A COLON). -
          3. If the require well-formed flag is set (its value is true), and this +
          4. If require well-formed is true, and this attr's 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 @@

            Extensibility

          5. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
          6. The result of serializing an attribute value given attr's - value attribute and the require well-formed flag as input; + value attribute and require well-formed as input;
          7. """ (U+0022 QUOTATION MARK).
          @@ -1046,11 +1043,11 @@

          Extensibility

    -

    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:

      -
    1. If the require well-formed flag is set (its value is true), and +
    2. 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 would fail to produce a well-formed element serialization. @@ -1109,10 +1106,10 @@

      Extensibility

      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, + a boolean require well-formed, must 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 @@

      Extensibility

      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 @@

      Extensibility

      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:

        @@ -1188,11 +1185,11 @@

        Extensibility

        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:

          -
        1. If the require well-formed flag is set (its value is true), and +
        2. If require well-formed is true, and node's 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 @@

          Extensibility

          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, + a boolean require well-formed, must run the following steps:
            @@ -1231,7 +1228,7 @@

            Extensibility

          1. For each child child of node, in tree order, run the XML serialization algorithm given child, namespace, - prefix map, a reference to prefix index, and flag + prefix map, a reference to prefix index, and require well-formed. Concatenate the result to markup.
          2. Return the value of markup. @@ -1246,16 +1243,16 @@

            Extensibility

            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:

              -
            1. If the require well-formed flag is true and the node's +
            2. If require well-formed is 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. -
            3. If the require well-formed flag is true and the node's +
            4. If require well-formed is 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 @@ -1340,17 +1337,17 @@

              Extensibility

              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:

                -
              1. If the require well-formed flag is set (its value is true), and +
              2. If require well-formed is true, and node's 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. -
              3. If the require well-formed flag is set (its value is true), and +
              4. If require well-formed is true, and node's 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 Date: Mon, 17 Aug 2026 00:47:50 +0200 Subject: [PATCH 19/67] Editorial: Remove redundant 'the value of' --- index.html | 104 ++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/index.html b/index.html index ce01357..3f0e5ce 100644 --- a/index.html +++ b/index.html @@ -464,7 +464,7 @@

                Extensibility

              5. Let inherited ns be a copy of namespace. -
              6. Let ns be the value of node's +
              7. Let ns be node's namespaceURI attribute.
              8. If inherited ns is equal to ns, then: @@ -473,14 +473,14 @@

                Extensibility

                ignore namespace definition attribute to true.
              9. If ns is the XML namespace, then append to - qualified name the concatenation of the string "xml:" and the - value of node's localName. + qualified name the concatenation of the string "xml:" and + node's localName. -
              10. Otherwise, append to qualified name the value of node's +
              11. Otherwise, append to qualified name node's localName. The node's prefix if it exists, is dropped. -
              12. Append the value of qualified name to markup. +
              13. Append qualified name to markup.
            5. Otherwise, inherited ns is not equal to ns (the node's @@ -491,7 +491,7 @@

              Extensibility

              cases can run into conflicts with existing attributes on the element and are handled accordingly. -->
                -
              1. Let prefix be the value of node's +
              2. Let prefix be node's prefix attribute.
              3. Let candidate prefix be the result of @@ -501,14 +501,14 @@

                Extensibility

                The above can return null if no namespace key ns exists in map.

                -
              4. If the value of prefix matches "xmlns", then run the following +
              5. If prefix matches "xmlns", then run the following steps:
                1. If require well-formed is true, then throw an error. An Element with prefix "xmlns" will not legally round-trip in a conforming XML parser. -
                2. Let candidate prefix be the value of prefix. +
                3. Let candidate prefix be prefix.
              6. Otherwise, the node has a local default namespace that matches - ns. Append to qualified name the value of node's - 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 @@

                Extensibility

              7. Append ">" (U+003E GREATER-THAN SIGN) to markup. -
              8. If the value of skip end tag is true, then return the value of - markup and skip the remaining steps. The node is a leaf-node. +
              9. If skip end tag is true, then return markup and skip the remaining + steps. The node is a leaf-node.
              10. If ns is the HTML namespace, and the node's localName matches the string "template", then this is a @@ -709,12 +709,12 @@

                Extensibility

                1. "</" (U+003C LESS-THAN SIGN, U+002F SOLIDUS); -
                2. The value of qualified name; +
                3. qualified name;
                4. ">" (U+003E GREATER-THAN SIGN).
                -
              11. Return the value of markup. +
              12. Return markup.
    @@ -743,10 +743,10 @@

    Extensibility

    "pretend-namespace") are not included).

      -
    1. Let attribute namespace be the value of attr's +
    2. Let attribute namespace be attr's namespaceURI value. -
    3. Let attribute prefix be the value of attr's +
    4. Let attribute prefix be attr's prefix.
    5. If the attribute namespace is the XMLNS namespace, then: @@ -759,10 +759,10 @@

      Extensibility

    6. Otherwise, the attribute prefix is not null and attr is a namespace prefix definition. Run the following steps:
        -
      1. Let prefix definition be the value of attr's +
      2. Let prefix definition be attr's localName. -
      3. Let namespace definition be the value of attr's +
      4. Let namespace definition be attr's value.
      5. If namespace definition is the XML namespace, then stop running @@ -788,13 +788,13 @@

        Extensibility

      6. Add the prefix prefix definition to map given namespace namespace definition. -
      7. Add the value of prefix definition as a new key to the +
      8. Add prefix definition as a new key to the local prefixes map, with the namespace definition as the - key's value replacing the value of null with the empty string if applicable. + key's value replacing null with the empty string if applicable.
    -
  • Return the value of default namespace attr value. +
  • Return default namespace attr value.

    The empty string is a legitimate return value and is not converted to null.

    @@ -860,7 +860,7 @@

    Extensibility

    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 the value of prefix occurs at least once in candidates list, return +
  • If prefix occurs at least once in candidates list, return true, otherwise return false.
  • @@ -924,7 +924,7 @@

    Extensibility

    attribute and localName attribute, and add it to the localname set. -
  • Let attribute namespace be the value of attr's +
  • Let attribute namespace be attr's namespaceURI value. @@ -937,7 +937,7 @@

    Extensibility

    attribute namespace with preferred prefix being attr's prefix value. -
  • If the value of attribute namespace is the XMLNS namespace, then run +
  • If attribute namespace is the XMLNS namespace, then run these steps:
    1. If any of the following are true, then stop running these steps and goto Loop @@ -972,7 +972,7 @@

      Extensibility

    2. If require well-formed is true, and - the value of attr's 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 @@

      Extensibility

      with strict qualifications.

    3. If require well-formed is true, and - the value of attr's 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 @@

      Extensibility

    4. The string "xmlns:"; -
    5. The value of candidate prefix; +
    6. candidate prefix;
    7. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); @@ -1028,7 +1028,7 @@

      Extensibility

    8. Append the following strings to result, in the order listed:
        -
      1. The value of attr's localName; +
      2. attr's localName;
      3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); @@ -1038,7 +1038,7 @@

        Extensibility

      4. """ (U+0022 QUOTATION MARK).
    -
  • Return the value of result. +
  • Return result. @@ -1054,8 +1054,8 @@

    Extensibility

  • If attribute value is null, then return the empty string. -
  • Otherwise, attribute value is a string. Return the value of - attribute value, first replacing any occurrences of the following: +
  • Otherwise, attribute value is a string. Return attribute value, first + replacing any occurrences of the following:
    1. "&" with "&amp;" @@ -1129,7 +1129,7 @@

      Extensibility

      at most one DocumentType node. (Text nodes are not allowed as children of the Document.)

      -
    2. Return the value of serialized document. +
    3. Return serialized document.
    @@ -1171,7 +1171,7 @@

    Extensibility

  • Let markup be the concatenation of "<![CDATA[", node's data, and "]]>". -
  • Return the value of markup. +
  • Return markup. @@ -1194,7 +1194,7 @@

    Extensibility

    Char production, then throw an exception; the serialization of this node's data would not be well-formed. -
  • Let markup be the value of node's data. +
  • Let markup be node's data.
  • Replace any occurrences of "&" in markup by "&amp;". @@ -1205,7 +1205,7 @@

    Extensibility

  • Replace any occurrences of ">" in markup by "&gt;". -
  • Return the value of markup. +
  • Return markup. @@ -1231,7 +1231,7 @@

    Extensibility

    prefix map, a reference to prefix index, and require well-formed. Concatenate the result to markup. -
  • Return the value of markup. +
  • Return markup. @@ -1264,7 +1264,7 @@

    Extensibility

  • Append " " (U+0020 SPACE) to markup. -
  • Append the value of the node's name +
  • Append the node's name attribute to markup. For a node belonging to an HTML document, the value will be all lowercase. @@ -1279,7 +1279,7 @@

    Extensibility

  • """ (U+0022 QUOTATION MARK); -
  • The value of the node's publicId attribute; +
  • the node's publicId attribute;
  • """ (U+0022 QUOTATION MARK). @@ -1300,7 +1300,7 @@

    Extensibility

  • """ (U+0022 QUOTATION MARK); -
  • The value of the node's systemId attribute; +
  • the node's systemId attribute;
  • """ (U+0022 QUOTATION MARK). @@ -1315,7 +1315,7 @@

    Extensibility

  • "[" (U+005B LEFT SQUARE BRACKET); -
  • The value of the node's internalSubset attribute; +
  • the node's internalSubset attribute;
  • "]" (U+005D RIGHT SQUARE BRACKET); @@ -1325,7 +1325,7 @@

    Extensibility

    -->
  • Append ">" (U+003E GREATER-THAN SIGN) to markup. -
  • Return the value of markup. +
  • Return markup. @@ -1357,16 +1357,16 @@

    Extensibility

    1. "<?" (U+003C LESS-THAN SIGN, U+003F QUESTION MARK); -
    2. The value of node's target; +
    3. node's target;
    4. " " (U+0020 SPACE); -
    5. The value of node's data; +
    6. node's data;
    7. "?>" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN).
    -
  • Return the value of markup. +
  • Return markup. From 764a35ce4cc5b59f0599e7c35b44c8a35191c855 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:50 +0200 Subject: [PATCH 20/67] Editorial: Cross-reference local name concepts rather than localName attributes --- index.html | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/index.html b/index.html index 3f0e5ce..fb342bb 100644 --- a/index.html +++ b/index.html @@ -423,7 +423,7 @@

    Extensibility

    1. If require well-formed is true, - and this node's 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 @@

      Extensibility

    2. If ns is the XML namespace, then append to qualified name the concatenation of the string "xml:" and - node's localName. + node's [=Element/local name=].
    3. Otherwise, append to qualified name node's - localName. The node's + [=Element/local name=]. The node's prefix if it exists, is dropped.
    4. Append qualified name to markup. @@ -524,8 +524,8 @@

      Extensibility

      1. Append to qualified name the concatenation of - candidate prefix, ":" (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 @@

        Extensibility

        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 localName in node's + namespace prefix declaration of the same [=Attr/local name=] in node's attribute list.

          @@ -561,7 +561,7 @@

          Extensibility

        1. Add prefix to map given namespace ns.
        2. Append to qualified name the concatenation of prefix, - ":" (U+003A COLON), and node's localName. + ":" (U+003A COLON), and node's [=Element/local name=].
        3. Append qualified name to markup. @@ -604,8 +604,7 @@

          Extensibility

          1. Set ignore namespace definition attribute to true. -
          2. Append to qualified name node's - localName. +
          3. Append to qualified name node's [=Element/local name=].
          4. Let inherited ns be ns. @@ -637,7 +636,7 @@

            Extensibility

            So, we'll just use that and drop the prefix -->
          5. Otherwise, the node has a local default namespace that matches ns. Append to qualified name node's - 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 @@

            Extensibility

            ignore namespace definition attribute, and require well-formed.
          6. If ns is the HTML namespace, and the node's list of - children is empty, and the node's 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 @@

            Extensibility

            steps. The node is a leaf-node.
          7. If ns is the HTML namespace, and the node's - 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 @@

            Extensibility

          8. Otherwise, the attribute prefix is not null and attr is a namespace prefix definition. Run the following steps:
              -
            1. Let prefix definition be attr's - localName. +
            2. Let prefix definition be attr's [=Attr/local name=].
            3. Let namespace definition be attr's value. @@ -904,10 +902,10 @@

              Extensibility

            4. Let localname set be a new empty namespace localname set. This localname set will contain tuples of unique attribute - 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.
            5. Loop: For each attribute attr in element's @@ -917,11 +915,11 @@

              Extensibility

            6. 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 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.
            7. Create a new tuple consisting of attr's namespaceURI - attribute and localName attribute, and add it to the + attribute and [=Attr/local name=], and add it to the localname set.
            8. Let attribute namespace be attr's @@ -956,15 +954,15 @@

              Extensibility

            9. the attr's prefix is not null and either
                -
              • the attr's localName is +
              • the attr's [=Attr/local name=] is not a key contained in the local prefixes map, or -
              • the attr's localName is +
              • the attr's [=Attr/local name=] is present in the local prefixes map but the value of the key does not match attr's value
              and furthermore that the attr's - 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 @@

              Extensibility

              the concatenation of candidate prefix with ":" (U+003A COLON).
            10. If require well-formed is true, and this - attr's 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 @@

              Extensibility

            11. Append the following strings to result, in the order listed:
                -
              1. attr's localName; +
              2. attr's [=Attr/local name=];
              3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); @@ -1412,7 +1410,6 @@

                Dependencies

                tree order;
              4. The Attr interface and its - attr.localName, attr.namespaceURI, attr.prefix and attr.value attributes @@ -1429,7 +1426,6 @@

                Dependencies

              5. The DocumentFragment interface
              6. The Element interface and its attributes list, - element.localName, setAttribute method
              7. The Node interface
              8. The ProcessingInstruction interface and its From 6047241cf4d62062bb58b249cce6c9f860ec3813 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:51 +0200 Subject: [PATCH 21/67] Editorial: Cross-reference namespace and namespace prefix concepts --- index.html | 106 +++++++++++++++++++++++------------------------------ 1 file changed, 46 insertions(+), 60 deletions(-) diff --git a/index.html b/index.html index fb342bb..a96eb51 100644 --- a/index.html +++ b/index.html @@ -177,7 +177,7 @@

                Extensibility

                ┗━ Text (data: "alert('hello world')") An XML serialization must include the 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 @@

                Extensibility

                • Elements and attributes will always be serialized such - that their 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.
                • Elements not in the HTML namespace containing no children, are serialized using the empty-element tag syntax (i.e., according to the XML @@ -340,7 +340,7 @@

                  Extensibility

                • 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 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 @@

                  Extensibility

                • Given prefix map, copy a namespace prefix map and let map be the result. -
                • Let local prefixes map be an empty map. The map has unique Node - prefix strings as its keys, with corresponding namespaceURI - Node values as the map's key values (in this map, the null namespace is +
                • 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).

                  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.

                  + 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.

                • Let local default namespace be the result of recording the namespace information for node given map and @@ -464,8 +461,7 @@

                  Extensibility

                • Let inherited ns be a copy of namespace. -
                • Let ns be node's - namespaceURI attribute. +
                • Let ns be node's [=Element/namespace=].
                • If inherited ns is equal to ns, then:
                    @@ -478,7 +474,7 @@

                    Extensibility

                  1. Otherwise, append to qualified name node's [=Element/local name=]. The node's - prefix if it exists, is dropped. + [=Element/namespace prefix=] if it exists, is dropped.
                  2. Append qualified name to markup.
                  @@ -491,8 +487,7 @@

                  Extensibility

                  cases can run into conflicts with existing attributes on the element and are handled accordingly. -->
                    -
                  1. Let prefix be node's - prefix attribute. +
                  2. Let prefix be node's [=Element/namespace prefix=].
                  3. Let candidate prefix be the result of retrieving a preferred prefix string prefix from map given @@ -505,20 +500,19 @@

                    Extensibility

                    steps:
                    1. If require well-formed is true, then throw an error. An - Element with prefix "xmlns" + Element with [=Element/namespace prefix=] "xmlns" will not legally round-trip in a conforming XML parser.
                    2. Let candidate prefix be prefix.
                  4. Found a suitable namespace prefix: if candidate prefix is not null (a namespace prefix is defined which maps to ns), then: -

                    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 @@

                    Extensibility

                    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. + [=Element/namespace=].
                  5. If the local default namespace is not null (there exists a locally-defined default namespace declaration attribute) and its value is not the @@ -535,7 +529,7 @@

                    Extensibility

                    local default namespace unless the local default namespace is the empty string in which case let it get null (the context namespace is changed to the declared default, rather - than this node's own namespace). + than this node's own [=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 @@

                    Extensibility

                    to ns, then:

                    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.

                    + there's no [=Element/namespace prefix=] (or candidate prefix) available; the + following uses the default namespace declaration to define the namespace—optionally replacing + an existing default declaration if present.

                    1. Set ignore namespace definition attribute to true. @@ -609,7 +603,7 @@

                      Extensibility

                    2. Let inherited ns be ns.

                      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.

                    3. Append qualified name to markup. @@ -641,7 +635,7 @@

                      Extensibility

                      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.

                      + preserving its original [=Element/namespace=].

                  6. Append to markup the result of the @@ -742,11 +736,9 @@

                    Extensibility

                    "pretend-namespace") are not included).

                      -
                    1. Let attribute namespace be attr's - namespaceURI value. +
                    2. Let attribute namespace be attr's [=Attr/namespace=]. -
                    3. Let attribute prefix be attr's - prefix. +
                    4. Let attribute prefix be attr's [=Attr/namespace prefix=].
                    5. If the attribute namespace is the XMLNS namespace, then:
                        @@ -803,17 +795,17 @@

                        Extensibility

                        The Namespace Prefix Map

                        -

                        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.

                        @@ -902,10 +894,10 @@

                        Extensibility

                      1. Let localname set be a new empty namespace localname set. This localname set will contain tuples of unique attribute - 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.
                      2. Loop: For each attribute attr in element's @@ -914,16 +906,14 @@

                        Extensibility

                        1. 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 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. -
                        2. Create a new tuple consisting of attr's namespaceURI - attribute and [=Attr/local name=], and add it to the - localname set. +
                        3. Create a new tuple consisting of attr's [=Attr/namespace=] and + [=Attr/local name=], and add it to the localname set. -
                        4. Let attribute namespace be attr's - namespaceURI value. +
                        5. Let attribute namespace be attr's [=Attr/namespace=].
                        6. Let candidate prefix be null. @@ -933,7 +923,7 @@

                          Extensibility

                        7. Let candidate prefix be the result of retrieving a preferred prefix string from map given namespace attribute namespace with preferred prefix being attr's - prefix value. + [=Attr/namespace prefix=].
                        8. If attribute namespace is the XMLNS namespace, then run these steps: @@ -948,11 +938,11 @@

                          Extensibility

                          problem, this algorithm always prefixes elements in the XML namespace with "xml" and drops any related definitions as seen in the above condition.

                          -
                        9. the attr's prefix is null and +
                        10. 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); -
                        11. the attr's prefix is not null and either +
                        12. the attr's [=Attr/namespace prefix=] is not null and either
                          • the attr's [=Attr/local name=] is not a key contained in the local prefixes map, or @@ -961,8 +951,7 @@

                            Extensibility

                            present in the local prefixes map but the value of the key does not match attr's value
                          - and furthermore that the attr's - [=Attr/local name=] (as the prefix to + and furthermore that the attr's [=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 @@ -983,7 +972,7 @@

                          Extensibility

                          then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). -
                        13. If the attr's prefix matches the string +
                        14. If the attr's [=Attr/namespace prefix=] matches the string "xmlns", then let candidate prefix be the string "xmlns".
                        @@ -1406,13 +1395,10 @@

                        Dependencies

                        ASCII case-insensitive string comparisons; a node's children, a HTML document; - a namespace concept; tree order;
                      3. The Attr interface and its - attr.namespaceURI, - attr.prefix and - attr.value attributes + attr.value attribute
                      4. The CharacterData interface's data attribute
                      5. The Comment interface From adc2fabf4323cb37f5db673fc65b59f12ba482b1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:51 +0200 Subject: [PATCH 22/67] Editorial: Cross-reference document element concept --- index.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index a96eb51..0c816f8 100644 --- a/index.html +++ b/index.html @@ -1096,11 +1096,9 @@

                        Extensibility

                        a boolean require well-formed, must run the following steps: -

                        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:

                          @@ -1112,7 +1110,7 @@

                          Extensibility

                          result to serialized document.

                          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 @@

                          Dependencies

                        1. The CharacterData interface's data attribute
                        2. The Comment interface -
                        3. The Document interface and its - documentElement attribute
                        4. The DocumentType interface and its doctype.name, From 774a94c08656afac2bc9c703098d017d9b4d43b1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:51 +0200 Subject: [PATCH 23/67] Editorial: Cross-reference DocumentType concepts --- index.html | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/index.html b/index.html index 0c816f8..0f23913 100644 --- a/index.html +++ b/index.html @@ -1111,7 +1111,7 @@

                          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 + at most one {{DocumentType}} node. (Text nodes are not allowed as children of the Document.)

                        5. Return serialized document. @@ -1232,16 +1232,16 @@

                          Extensibility

                          must run the following steps:
                            -
                          1. If require well-formed is 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. +
                          2. 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 + document type declaration. -
                          3. If require well-formed is 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 - node would not be a well-formed document type declaration. +
                          4. 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 + well-formed document type declaration.
                          5. Let markup be the empty string. @@ -1249,11 +1249,10 @@

                            Extensibility

                          6. Append " " (U+0020 SPACE) to markup. -
                          7. Append the node's name - attribute to markup. For a node belonging to an HTML document, the - value will be all lowercase. +
                          8. Append node's [=DocumentType/name=] to markup. For a node + belonging to an HTML document, the value will be all lowercase. -
                          9. If the node's publicId is not the empty string then append +
                          10. If node's [=DocumentType/public ID=] is not the empty string, then append the following, in the order listed, to markup:
                            1. " " (U+0020 SPACE); @@ -1264,13 +1263,13 @@

                              Extensibility

                            2. """ (U+0022 QUOTATION MARK); -
                            3. the node's publicId attribute; +
                            4. node's [=DocumentType/public ID=];
                            5. """ (U+0022 QUOTATION MARK).
                            -
                          11. If the node's systemId is not the empty string and the - node's publicId is set to the empty string, then append the +
                          12. If node's [=DocumentType/system ID=] is not the empty string and + node's [=DocumentType/public ID=] is the empty string, then append the following, in the order listed, to markup:
                            1. " " (U+0020 SPACE); @@ -1278,14 +1277,14 @@

                              Extensibility

                            2. The string "SYSTEM".
                            -
                          13. If the node's systemId is not the empty string then append +
                          14. If node's [=DocumentType/system ID=] is not the empty string, then append the following, in the order listed, to markup:
                            1. " " (U+0020 SPACE);
                            2. """ (U+0022 QUOTATION MARK); -
                            3. the node's systemId attribute; +
                            4. node's [=DocumentType/system ID=];
                            5. """ (U+0022 QUOTATION MARK).
                            @@ -1400,11 +1399,6 @@

                            Dependencies

                          15. The CharacterData interface's data attribute
                          16. The Comment interface -
                          17. The DocumentType interface and its - doctype.name, - - publicId and - systemId attributes
                          18. The DocumentFragment interface
                          19. The Element interface and its attributes list, From 4afcb40d4b75759c8d117cdb14838f4822caff55 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:51 +0200 Subject: [PATCH 24/67] Editorial: Cross-reference ProcessingInstruction concepts --- index.html | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 0f23913..9e2fd4f 100644 --- a/index.html +++ b/index.html @@ -1109,7 +1109,7 @@

                            Extensibility

                            map, prefix index, and require well-formed, and append the result to serialized document. -

                            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 @@

                            Extensibility

                            must run the following steps:
                              -
                            1. If require well-formed is true, and - node's target contains a ":" (U+003A COLON) +
                            2. 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 throw an exception; the serialization of this node's - target would not be well-formed. + [=ProcessingInstruction/target=] would not be well-formed. -
                            3. If require well-formed is true, and - node's data contains characters that are not matched by the XML +
                            4. 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, 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.
                            5. Let markup be the concatenation of the following, in the order listed:
                              1. "<?" (U+003C LESS-THAN SIGN, U+003F QUESTION MARK); -
                              2. node's target; +
                              3. node's [=ProcessingInstruction/target=];
                              4. " " (U+0020 SPACE); -
                              5. node's data; +
                              6. node's [=CharacterData/data=];
                              7. "?>" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN).
                              @@ -1404,8 +1404,6 @@

                              Dependencies

                              attributes list, setAttribute method
                            6. The Node interface -
                            7. The ProcessingInstruction interface and its - target attribute
                            8. The Range interface
                            9. The Text interface
                            10. The following DOMException: From c5254634d92e5bbf3dcea0e940f7db50406350e2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:52 +0200 Subject: [PATCH 25/67] Editorial: Cross-reference Attr's value concept --- index.html | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index 9e2fd4f..30dbe65 100644 --- a/index.html +++ b/index.html @@ -744,7 +744,7 @@

                              Extensibility

                              1. If attribute prefix is null, then attr is a default namespace declaration. Set the default namespace attr value to attr's - 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.
                              2. Otherwise, the attribute prefix is not null and attr @@ -752,8 +752,7 @@

                                Extensibility

                                1. Let prefix definition be attr's [=Attr/local name=]. -
                                2. Let namespace definition be attr's - value. +
                                3. Let namespace definition be attr's [=Attr/value=].
                                4. If namespace definition is the XML namespace, then stop running these steps, and return to Main to visit the next attribute. @@ -931,7 +930,7 @@

                                  Extensibility

                                5. If any of the following are true, then stop running these steps and goto Loop to visit the next attribute:
                                    -
                                  • the attr's value is the XML namespace; +
                                  • the 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 @@ -947,19 +946,18 @@

                                    Extensibility

                                  • the attr's [=Attr/local name=] is not a key contained in the local prefixes map, or -
                                  • the attr's [=Attr/local name=] is - present in the local prefixes map but the value of the key does not match - attr's value +
                                  • 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=]
                                  and furthermore that the attr's [=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 + 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).
                -
              9. If require well-formed is true, and - attr's value attribute matches the +
              10. 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. @@ -967,10 +965,9 @@

                Extensibility

                DOM APIs do allow creation of elements in the XMLNS namespace but with strict qualifications.

                -
              11. If require well-formed is true, and - 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). +
              12. 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).
              13. If the attr's [=Attr/namespace prefix=] matches the string "xmlns", then let candidate prefix be the string @@ -1020,7 +1017,7 @@

                Extensibility

              14. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
              15. The result of serializing an attribute value given attr's - value attribute and require well-formed as input; + [=Attr/value=] and require well-formed as input;
              16. """ (U+0022 QUOTATION MARK).
              @@ -1394,8 +1391,7 @@

              Dependencies

              a HTML document; tree order;
            12. -
            13. The Attr interface and its - attr.value attribute +
            14. The Attr interface
            15. The CharacterData interface's data attribute
            16. The Comment interface From a95cb7441782456f4bdaa1db31f38ba28643acab Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:52 +0200 Subject: [PATCH 26/67] Editorial: Cross-reference CharacterData's data concept --- index.html | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index 30dbe65..245c3b8 100644 --- a/index.html +++ b/index.html @@ -1126,15 +1126,14 @@

              Extensibility

              a boolean require well-formed, must run the following steps: -

              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 "-->".

  • @@ -1151,7 +1150,7 @@

    Extensibility

    1. Let markup be the concatenation of "<![CDATA[", - node's data, and "]]>". + node's [=CharacterData/data=], and "]]>".
    2. Return markup.
    @@ -1171,12 +1170,12 @@

    Extensibility

    must run the following steps:
      -
    1. If require well-formed is true, and - node's 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. +
    2. 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=] + would not be well-formed. -
    3. Let markup be node's data. +
    4. Let markup be node's [=CharacterData/data=].
    5. Replace any occurrences of "&" in markup by "&amp;". @@ -1392,7 +1391,6 @@

      Dependencies

      tree order;
    6. The Attr interface -
    7. The CharacterData interface's data attribute
    8. The Comment interface
    9. The DocumentFragment interface From 6df4474a1dbb9149e56f0c03f801db9dc94a4f2a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:52 +0200 Subject: [PATCH 27/67] Editorial: Cross-reference DOMException directly --- index.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/index.html b/index.html index 245c3b8..62f6dc5 100644 --- a/index.html +++ b/index.html @@ -348,8 +348,7 @@

      Extensibility

      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. + then catch that exception and throw an {{"InvalidStateError"}} {{DOMException}}.
    @@ -1400,8 +1399,6 @@

    Dependencies

  • The Node interface
  • The Range interface
  • The Text interface -
  • The following DOMException: - "InvalidStateError" The following terms used in this document are defined by [[DOM]]: From c591228755abb60e5ca7a89277c94e263eecae15 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:52 +0200 Subject: [PATCH 28/67] Editorial: Cross-reference setAttribute directly --- index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 62f6dc5..ee8c339 100644 --- a/index.html +++ b/index.html @@ -731,8 +731,8 @@

    Extensibility

    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).

    + declarations via {{Element/setAttribute(qualifiedName, + value)|setAttribute("xmlns:pretend-prefix", "pretend-namespace")}} are not included).

    1. Let attribute namespace be attr's [=Attr/namespace=]. @@ -1395,7 +1395,6 @@

      Dependencies

    2. The DocumentFragment interface
    3. The Element interface and its attributes list, - setAttribute method
    4. The Node interface
    5. The Range interface
    6. The Text interface From 47a5950a33dc07dcbd6ee55b9db1d3872a6d53f9 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:53 +0200 Subject: [PATCH 29/67] Editorial: Cross-reference attributes directly --- index.html | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index ee8c339..f6bbfe8 100644 --- a/index.html +++ b/index.html @@ -340,9 +340,9 @@

      Extensibility

    7. 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 - 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.
    8. Return the result of running the XML serialization algorithm given node, namespace, prefix map, generated namespace prefix index reference @@ -531,7 +531,8 @@

      Extensibility

      than this node's own [=Element/namespace=]).

      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=].

    9. Append qualified name to markup.
    @@ -544,7 +545,7 @@

    Extensibility

    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 - attribute list.

    + [=Element/attribute list=].

    1. If the local prefixes map contains a key matching prefix, @@ -725,14 +726,14 @@

      Extensibility

      1. Let default namespace attr value be null. -
      2. Main: For each attribute attr in element's - attributes, in the order they are specified in the element's - attribute list: +
      3. Main: [=list/For each=] attr of element's + [=Element/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).

        1. Let attribute namespace be attr's [=Attr/namespace=]. @@ -894,13 +895,13 @@

          Extensibility

          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. + 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. -
        2. Loop: For each attribute attr in element's - attributes, in the order they are specified in the element's - attribute list: +
        3. Loop: [=list/For each=] attr of element's + [=Element/attribute list=]:
          1. If require well-formed is true, and the localname set contains a tuple whose values match those of a new tuple consisting @@ -953,7 +954,7 @@

            Extensibility

            find) is found in map given the namespace consisting 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). + element whose attributes are being processed).
          2. If require well-formed is true, and attr's [=Attr/value=] is the @@ -1393,8 +1394,7 @@

            Dependencies

          3. The Comment interface
          4. The DocumentFragment interface -
          5. The Element interface and its - attributes list, +
          6. The Element interface
          7. The Node interface
          8. The Range interface
          9. The Text interface From 4f6514c8b1bd42ac7242dc7b52a7f689b859df8a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:53 +0200 Subject: [PATCH 30/67] Editorial: Remove unnecessary references to 'tree order' --- index.html | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index f6bbfe8..30af91c 100644 --- a/index.html +++ b/index.html @@ -693,10 +693,13 @@

            Extensibility

            This allows template content to round-trip, given the rules for parsing XHTML documents.

            -
          10. Otherwise, append to markup the result of running the - XML serialization algorithm on each of node's children, in - tree order, given the child, inherited ns, map, - prefix index, and require well-formed. +
          11. +

            Otherwise, [=set/for each=] child of node's [=tree/children=]: +

              +
            1. Append to markup the result of running the XML serialization algorithm + given |child|, inherited ns, map, prefix index, and + require well-formed. +
          12. Append the following to markup, in the order listed:
              @@ -1101,15 +1104,18 @@

              Extensibility

              1. Let serialized document be the empty string. -
              2. For each child child of node, in tree order, run the - XML serialization algorithm given child, inherited ns, - map, prefix index, and require well-formed, and append the - result to serialized document. +
              3. +

                [=set/For each=] child of node's [=tree/children=]: +

                  +
                1. Append to serialized document the result of running the + XML serialization algorithm given |child|, inherited ns, map, + prefix index, and require well-formed. +
                -

                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.)

              4. Return serialized document.
              @@ -1207,10 +1213,13 @@

              Extensibility

              1. Let markup be the empty string. -
              2. For each child child of node, in tree order, run the - XML serialization algorithm given child, namespace, - prefix map, a reference to prefix index, and - require well-formed. Concatenate the result to markup. +
              3. +

                [=set/For each=] child of node's [=tree/children=]: +

                  +
                1. Append to markup the result of running the XML serialization algorithm + given |child|, inherited ns, map, prefix index, and + require well-formed. +
              4. Return markup.
              @@ -1388,7 +1397,6 @@

              Dependencies

              ASCII case-insensitive string comparisons; a node's children, a HTML document; - tree order;
            1. The Attr interface
            2. The Comment interface From d0b6df59bf7cb9f23e49f5db8ebe12c5c3ef2f32 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:53 +0200 Subject: [PATCH 31/67] Editorial: Cross-reference the template element directly --- index.html | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 30af91c..e6d7353 100644 --- a/index.html +++ b/index.html @@ -683,10 +683,9 @@

              Extensibility

              steps. The node is a leaf-node.
            3. If ns is the HTML namespace, and the node's - [=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), + [=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 @@

              Dependencies

              HTML parser; parsing XHTML documents; XML parser; -
            4. The following elements: - template
            5. void elements
            6. The template's template contents
            7. The innerHTML property; From 7dc4a34ed3f9cde0287f9a4aad2a7bd9c301e966 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:54 +0200 Subject: [PATCH 32/67] Editorial: Cross-reference 'HTML document' directly --- index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.html b/index.html index e6d7353..5bc4024 100644 --- a/index.html +++ b/index.html @@ -1392,8 +1392,7 @@

              Dependencies

            8. The following concepts: case-sensitive and ASCII case-insensitive string comparisons; - a node's children, - a HTML document; + a node's children
            9. The Attr interface
            10. The Comment interface From d43ff2825ca439d5bc6f8bd46828b237f26be2ed Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:54 +0200 Subject: [PATCH 33/67] Editorial: Cross-reference 'children' directly --- index.html | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 5bc4024..357d355 100644 --- a/index.html +++ b/index.html @@ -306,15 +306,15 @@

              Extensibility

              might be dropped, substituted or changed. An HTML serialization does not attempt to preserve the namespace. -
            11. Elements not in the HTML namespace containing no children, are +
            12. Elements 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).

              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 @@

              Extensibility

              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=].

            13. Append qualified name to markup. @@ -643,8 +643,8 @@

              Extensibility

              given map, prefix index, local prefixes map, ignore namespace definition attribute, and require well-formed. -
            14. If ns is the HTML namespace, and the node's list of - children is empty, and the node's [=Element/local name=] matches any +
            15. If ns is the HTML namespace, and the node's [=tree/children=] + is empty, and the node's [=Element/local name=] matches any one of the following void elements: "area", "base", @@ -673,8 +673,8 @@

              Extensibility

            and set skip end tag to true. -
          13. If ns is not the HTML namespace, and the node's list of - children is empty, then append "/" (U+002F SOLIDUS) to markup +
          14. If ns is not the HTML namespace, and the node's + [=tree/children=] is empty, then append "/" (U+002F SOLIDUS) to markup and set skip end tag to true.
          15. Append ">" (U+003E GREATER-THAN SIGN) to markup. @@ -1392,7 +1392,6 @@

            Dependencies

          16. The following concepts: case-sensitive and ASCII case-insensitive string comparisons; - a node's children
          17. The Attr interface
          18. The Comment interface From 9d27b14f79f5eabf463763bb70d1402f28dcab6b Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:54 +0200 Subject: [PATCH 34/67] Editorial: Cross-reference 'ASCII case-insensitive' directly --- index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 357d355..6295f3e 100644 --- a/index.html +++ b/index.html @@ -1389,9 +1389,8 @@

            Dependencies

            The DOM specification [[!DOM4]] defines the following terms used in this document:
              -
            • The following concepts: - case-sensitive and - ASCII case-insensitive string comparisons; +
            • The following concept: + case-sensitive string comparisons;
            • The Attr interface
            • The Comment interface From 9f1918d6888da4bfdc5abee64e27151e885febb8 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:54 +0200 Subject: [PATCH 35/67] Editorial: Remove obsolete reference to 'case-sensitive' This is covered in Infra. Fixes #74. --- index.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/index.html b/index.html index 6295f3e..741ffdf 100644 --- a/index.html +++ b/index.html @@ -82,8 +82,6 @@

              Candidate Recommendation Exit Criteria

              behavior by overriding attributes or methods with custom properties or functions in ECMAScript. [[ECMA-262]] -

              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 @@

              Dependencies

              The DOM specification [[!DOM4]] defines the following terms used in this document:
                -
              • The following concept: - case-sensitive string comparisons; -
              • The Attr interface
              • The Comment interface From e5130864fd732ebbf97253bae33276e2a367a7c0 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 17 Aug 2026 00:47:55 +0200 Subject: [PATCH 36/67] Editorial: Consistently cross-reference interfaces and interface members --- index.html | 96 +++++++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 55 deletions(-) diff --git a/index.html b/index.html index 741ffdf..20b0924 100644 --- a/index.html +++ b/index.html @@ -109,17 +109,17 @@

                Extensibility

                Introduction

                -

                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. -

                For example: the innerHTML API is a common way to both - parse and serialize a DOM (it does both). If a particular Node, has the following in-memory +
                For example: the {{Element.innerHTML}} API is a common way to both + parse and serialize a DOM (it does both). If a particular {{Node}} has the following in-memory 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 the HTMLScriptElement Node's - [=Element/namespace=] in order to preserve the identity of the - script element, and to allow the serialized string to + An XML serialization must include the {{HTMLScriptElement}}'s [=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: @@ -191,7 +190,7 @@

                Extensibility

                APIs for parsing and serializing DOM

                -

                The DOMParser interface

                +

                The {{DOMParser}} interface

                @@ -202,16 +201,16 @@

                Extensibility

                -

                The definition of DOMParser has moved to the HTML Standard.

                +

                The definition of {{DOMParser}} has moved to the HTML Standard.

                -

                The XMLSerializer interface

                +

                The {{XMLSerializer}} interface

                -

                The definition of XMLSerializer has moved to the HTML Standard.

                +

                The definition of {{XMLSerializer}} has moved to the HTML Standard.

                @@ -219,31 +218,31 @@

                Extensibility

                -

                The definition of InnerHTML has moved to the HTML Standard.

                +

                The definition of {{Element.innerHTML}} has moved to the HTML Standard.

                -

                Extensions to the Element interface

                +

                Extensions to the {{Element}} interface

                -

                The definition of outerHTML has moved to the HTML Standard.

                +

                The definition of {{Element.outerHTML}} has moved to the HTML Standard.

                -

                The definition of insertAdjacentHTML has moved to the HTML Standard.

                +

                The definition of {{Element.insertAdjacentHTML}} has moved to the HTML Standard.

                -

                Extensions to the Range interface

                +

                Extensions to the {{Range}} interface

                -

                The definition of createContextualFragment has moved to the HTML Standard.

                +

                The definition of {{Range.createContextualFragment()}} has moved to the HTML Standard.

                @@ -283,7 +282,7 @@

                Extensibility

                -

                The definition of fragment parsing algorithm has moved to the HTML Standard.

                +

                The definition of fragment parsing algorithm has moved to the HTML Standard.

                @@ -291,20 +290,20 @@

                Extensibility

                -

                The definition of fragment serializing algorithm has 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:

                  -
                • 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).
                @@ -314,20 +313,20 @@

                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]], Attr objects 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 Node node given +

                To produce an XML serialization of a {{Node}} node given a boolean require well-formed, run the following steps:

                1. 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.
                2. 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.

                3. Let local default namespace be the result of recording the namespace information for node given map and @@ -497,7 +496,7 @@

                  Extensibility

                  steps:
                  1. 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.
                  2. 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

                  3. 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

                  4. 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 (a DocumentFragment), + 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

                  5. 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);
                  6. the attr's [=Attr/namespace prefix=] is not null and either
                      @@ -1109,10 +1108,10 @@

                      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}}.)

                4. Return serialized document.
                @@ -1384,19 +1383,6 @@

                Dependencies

              • The insertAdjacentHTML method;
              - The DOM specification [[!DOM4]] defines the following terms used in this document: - - - The following terms used in this document are defined by [[DOM]]:
                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

                1. 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.
                2. 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=].
                3. 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.
                4. 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. -
        4. If ns is not the HTML namespace, and the node's +
        5. 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.
        6. Append ">" (U+003E GREATER-THAN SIGN) to markup.
        7. 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. -
        8. If ns is the HTML namespace, and the node's +
        9. 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

          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

        10. Let attribute prefix be attr's [=Attr/namespace prefix=]. -
        11. If the attribute namespace is the XMLNS namespace, then: +
        12. If attribute namespace is the XMLNS namespace, then:
          1. 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. -
          2. Otherwise, the attribute prefix is not null and attr +
          3. Otherwise, attribute prefix is not null and attr is a namespace prefix definition. Run the following steps:
            1. 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.

            2. Add the prefix prefix definition to map given namespace namespace definition. -
            3. 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. +
            4. 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.
        @@ -808,7 +807,7 @@

        Extensibility

        details.

        -

        To 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

      4. If prefix matches preferred prefix, then stop running these steps and return prefix. -
      5. If prefix is the last item in the candidates list, then stop running +
      6. If prefix is the last item in candidates list, then stop running these steps and return prefix.
    @@ -890,7 +889,7 @@

    Extensibility

    1. Let result be the empty string. -
    2. Let localname set be a new empty namespace localname set. This +
    3. 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

    4. Loop: [=list/For each=] attr of element's [=Element/attribute list=]:
        -
      1. 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 +
      2. 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.
      3. 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.
      4. Let attribute namespace be attr's [=Attr/namespace=]. @@ -929,29 +927,28 @@

        Extensibility

      5. If any of the following are true, then stop running these steps and goto Loop to visit the next attribute:
          -
        • 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
            -
          • 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=]
          - 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).
        @@ -968,12 +965,12 @@

        Extensibility

        empty string, then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). -
      6. If the attr's [=Attr/namespace prefix=] matches the string +
      7. If attr's [=Attr/namespace prefix=] matches the string "xmlns", then let candidate prefix be the string "xmlns".
      -
    5. Otherwise, the attribute namespace in not the XMLNS namespace. Run +
    6. Otherwise, attribute namespace in not the XMLNS namespace. Run these steps:
      1. Let candidate prefix be the result of generating a prefix providing @@ -1002,11 +999,10 @@

        Extensibility

      2. If candidate prefix is not null, then append to result the concatenation of candidate prefix with ":" (U+003A COLON). -
      3. 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 +
      4. 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.
      5. Append the following strings to result, in the order listed: @@ -1032,7 +1028,7 @@

        Extensibility

        1. 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.
        2. If attribute value is null, then return the empty string. @@ -1069,8 +1065,7 @@

          Extensibility

        3. Let the value of prefix index be incremented by one. -
        4. Add to map the generated prefix given the - new namespace namespace. +
        5. Add to map generated prefix given new namespace.
        6. Return the value of generated prefix.
        @@ -1093,7 +1088,7 @@

        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

        1. 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.
        2. Let markup be node's [=CharacterData/data=]. @@ -1235,13 +1230,13 @@

          Extensibility

          1. 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.
          2. 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.
          3. Let markup be the empty string. @@ -1292,7 +1287,7 @@

            Extensibility

            ". +
          4. Otherwise, return the concatenation of "<!--", node's + [=CharacterData/data=], and "-->". +
  • From 77a13da6518af642910cdbe426a81085300bf880 Mon Sep 17 00:00:00 2001 From: Ms2ger 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: Ms2ger Date: 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: +

      +
    1. Let |copy| be a new [=namespace prefix map=]. +
    2. +

      [=map/For each=] |key| → |value| in map: +

        +
      1. Set |copy|[|key|] to a [=list/clone=] of |value|. +
      +
    3. 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:

      -
    1. 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. +
    2. If map does not [=map/contain=] ns, return null. -
    3. Otherwise, for each prefix value prefix in candidates list, iterating - from beginning to end: +
    4. Let candidates be map[ns]. -

      There will always be at least one prefix value in the list.

      +
    5. [=Assert=]: candidates [=list/is not empty=].
    6. -
        -
      1. If prefix matches preferred prefix, then stop running these steps - and return prefix. +
      2. [=list/For each=] prefix of candidates: -
      3. If prefix is the last item in candidates list, then stop running - these steps and return prefix. -
      +
        +
      1. If prefix is preferred prefix, return prefix. +
      + +
    7. 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:

      -
    1. 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. +
    2. If map does not [=map/contain=] ns, return false. + +
    3. Let candidates be map[ns]. -
    4. If prefix occurs at least once in candidates list, return - true, otherwise return false. +
    5. 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:

      -
    1. 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. - -
    2. 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. - -
    3. 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).

      +
    4. +

      If |map| does not [=map/contain=] |ns|: +

        +
      1. Let |candidates| be « |prefix| ». +
      2. Set |map|[|ns|] to |candidates|. +
      +
    5. +

      Otherwise: +

        +
      1. Let |candidates| be |map|[|ns|]. +
      2. [=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:
      -
    1. 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=]. +
    2. Let |prefix| be attr's [=Attr/namespace prefix=]. + +
    3. Set candidate prefix to the result of + retrieving a preferred prefix string |prefix| from map given + attribute namespace.
    4. 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.

      -
    5. attr's [=Attr/namespace prefix=] is null and - ignore namespace definition attribute is true (the +
    6. |prefix| is null and ignore namespace definition attribute is true (the {{Element}}'s default namespace attribute is to be skipped); -
    7. attr's [=Attr/namespace prefix=] is not null and either +
    8. |prefix| is not null and either
      • 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=]
      - 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 @@

      Extensibility

      empty string, then throw an exception; namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead). -
    9. If attr's [=Attr/namespace prefix=] matches the string - "xmlns", then let candidate prefix be the string - "xmlns". +
    10. 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}}. @@ -349,7 +350,7 @@

    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

    1. 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.
    2. 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

    3. Otherwise, attribute namespace in not the XMLNS namespace. Run these steps:
        -
      1. Let candidate prefix be the result of generating a prefix providing - map, attribute namespace, and prefix index as input. +
      2. Let candidate prefix be the result of generating a prefix given + map, attribute namespace, and prefix index.
      3. 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: +

          1. Let generated prefix be the concatenation of the string "ns" and the current numerical value of prefix index. -
          2. Let the value of prefix index be incremented by one. +
          3. Increment the value of prefix index by one.
          4. 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: Ms2ger Date: 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

          5. If prefix matches "xmlns", then run the following steps:
              -
            1. If require well-formed is true, then throw an error. An +
            2. 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

            3. 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.

            4. 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).
            5. If |prefix| matches the string "xmlns", then let candidate prefix be the string "xmlns". From dba15be588b472aa29c85af5a86ce4fa4e4b16b4 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: 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

            6. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
            7. The result of serializing an attribute value given ns and - require well-formed as input; + require well-formed;
            8. """ (U+0022 QUOTATION MARK).
            @@ -613,7 +613,7 @@

            Extensibility

          6. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
          7. The result of serializing an attribute value given ns and - require well-formed as input; + require well-formed;
          8. """ (U+0022 QUOTATION MARK).
          @@ -630,9 +630,8 @@

          Extensibility

          preserving its original [=Element/namespace=].

        -
      4. Append to markup the result of the - XML serialization of node's attributes - given map, prefix index, local prefixes map, +
      5. 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.
      6. 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

      7. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); -
      8. The result of serializing an attribute value given attribute namespace - and require well-formed as input; +
      9. The result of serializing an attribute value given + attribute namespace and require well-formed;
      10. """ (U+0022 QUOTATION MARK).
      @@ -1011,7 +1010,7 @@

      Extensibility

    4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
    5. The result of serializing an attribute value given attr's - [=Attr/value=] and require well-formed as input; + [=Attr/value=] and require well-formed;
    6. """ (U+0022 QUOTATION MARK).
    From 572bbcb05533bbde147775b037baad9cee65a136 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: 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:
    1. If local default namespace is not null, then set ignore namespace definition attribute to true. -
    2. If ns is the XML namespace, then append to - qualified name the concatenation of the string "xml:" and - node's [=Element/local name=]. +
    3. If ns is the XML namespace, then append the concatenation of + "xml:" and node's [=Element/local name=] to qualified name. -
    4. Otherwise, append to qualified name node's - [=Element/local name=]. node's - [=Element/namespace prefix=] if it exists, is dropped. +
    5. Otherwise, append node's [=Element/local name=] to qualified name. + node's [=Element/namespace prefix=] if it exists, is + dropped.
    6. 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):
    1. Let prefix definition be attr's [=Attr/local name=]. @@ -914,7 +911,7 @@

      Extensibility

    2. Let candidate prefix be null. -
    3. If attribute namespace is not null, then run these sub-steps: +
    4. If attribute namespace is not null, then:
      1. Let |prefix| be attr's [=Attr/namespace prefix=]. @@ -922,8 +919,7 @@

        Extensibility

        retrieving a preferred prefix string |prefix| from map given attribute namespace. -
      2. If attribute namespace is the XMLNS namespace, then run - these steps: +
      3. If attribute namespace is the XMLNS namespace, then:
        1. 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".
      4. Otherwise, attribute namespace in not the XMLNS namespace. Run @@ -977,7 +973,7 @@

        Extensibility

        1. " " (U+0020 SPACE); -
        2. The string "xmlns:"; +
        3. "xmlns:";
        4. candidate prefix; @@ -991,10 +987,10 @@

          Extensibility

      -
    5. Append a " " (U+0020 SPACE) to result. +
    6. Append " " (U+0020 SPACE) to result.
    7. 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).
    8. 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. -
    9. Append the following strings to result, in the order listed: +
    10. Append the following to result, in the order listed:
      1. attr's [=Attr/local name=]; @@ -1057,7 +1053,7 @@

        Extensibility

        reference to an integer prefix index:
          -
        1. Let generated prefix be the concatenation of the string "ns" and the +
        2. Let generated prefix be the concatenation of "ns" and the current numerical value of prefix index.
        3. 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. -
        4. Otherwise, run the following steps: +
        5. Otherwise:
          1. Let serialized document be the empty string. @@ -1241,7 +1237,7 @@

            Extensibility

          2. Let markup be the empty string. -
          3. Append the string "<!DOCTYPE" to markup. +
          4. Append "<!DOCTYPE" to markup.
          5. Append " " (U+0020 SPACE) to markup. @@ -1253,7 +1249,7 @@

            Extensibility

            1. " " (U+0020 SPACE); -
            2. The string "PUBLIC"; +
            3. "PUBLIC";
            4. " " (U+0020 SPACE); @@ -1270,7 +1266,7 @@

              Extensibility

              1. " " (U+0020 SPACE); -
              2. The string "SYSTEM". +
              3. "SYSTEM".
            5. If node's [=DocumentType/system ID=] is not the empty string, then append @@ -1323,13 +1319,13 @@

              Extensibility

              1. 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.
              2. 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: Ms2ger Date: 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

              3. Let |map:namespace prefix map| be the result of copy a namespace prefix map given prefix map. -
              4. 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). +
              5. +

                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=].

                  -
                1. If local prefixes map contains a key matching prefix, +
                2. 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:

                  1. Let default namespace attr value be null. @@ -763,9 +766,11 @@

                    Extensibility

                  2. Add prefix definition to map given namespace definition. -
                  3. 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. +
                  4. If namespace definition is null, then set namespace definition to + the empty string. + +
                  5. Set local prefixes map[prefix definition] to + namespace definition.
              @@ -935,11 +940,13 @@

              Extensibility

            6. |prefix| is not null and either
                -
              • 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=]
              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 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:
                -
              1. 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. +
              2. +

                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.

              3. 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

              4. 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=].

              5. 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

              6. 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: +
                  +
                1. If local default namespace is the empty string, set + inherited ns to null. +
                2. Otherwise, set inherited ns to local default namespace. +
                + (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 @@ -574,10 +578,13 @@

                Extensibility

            7. 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: + +
                +
              1. If local default namespace is the empty string, set + inherited ns to null. +
              2. Otherwise, set inherited ns to local default namespace. +
          6. Otherwise, if local default namespace is null, or @@ -623,9 +630,13 @@

            Extensibility

          7. 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. +
              +
            1. Append node's [=Element/local name=] to qualified name. + +
            2. Let inherited ns be ns. + +
            3. 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. -
          8. Let candidate prefix be prefix. +
          9. Set candidate prefix to prefix.
          +
        6. 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. +

          1. 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.

          2. If prefix is "xmlns", then:
              -
            1. 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. +
            2. 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.
            3. Set candidate prefix to prefix.
            @@ -504,29 +515,31 @@

            Extensibility

            matches the node's namespace. This prefix will be used in serialization even if the node doesn't have a real prefix. -->
          3. 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.

            1. 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=]. -
            2. If local default namespace is not null (there exists - a locally-defined default namespace declaration attribute) and its value is not the +
            3. If local default namespace is not null (node has a default + namespace declaration attribute) and is not the XML namespace, then:
              1. If local default namespace is the empty string, set inherited ns to null.
              2. Otherwise, set inherited ns to local default namespace.
              - (the context namespace is changed to the - declared default, rather than node's [=Element/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.

              1. If local prefixes map [=map/contains=] prefix, @@ -577,8 +592,8 @@

                Extensibility

              2. """ (U+0022 QUOTATION MARK).
              -
            4. If local default namespace is not null (there exists a - locally-defined default namespace declaration attribute), then: +
            5. If local default namespace is not null (node has a + default namespace declaration attribute), then:
              1. If local default namespace is the empty string, set @@ -627,9 +642,13 @@

                Extensibility

              2. """ (U+0022 QUOTATION MARK).
            + -
          4. Otherwise, local default namespace is ns. +
          5. Otherwise: + +

            local default namespace is ns. +

            1. Append node's [=Element/local name=] to qualified name. @@ -719,10 +738,10 @@

              Extensibility

              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

            2. If attribute namespace is the XMLNS namespace, then:
                -
              1. If attribute prefix is null, then attr is a default - namespace declaration. Set default namespace attr value to attr's +
              2. If attribute prefix is null (attr is a default namespace + declaration), set default namespace attr value to attr's [=Attr/value=], and [=iteration/continue=]. -
              3. Otherwise (attribute prefix is not null and attr - is a namespace prefix definition): +
              4. Otherwise:
                  +
                1. attribute prefix is not null and attr is a namespace + prefix definition. +
                2. Let prefix definition be attr's [=Attr/local name=].
                3. 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 "xml" prefix.

                  + {{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.

                4. 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

                  1. Let result be the empty string. -
                  2. 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. +
                  3. 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.

                  4. [=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|).
                    1. 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.

                    2. 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).
                    3. If |prefix| is "xmlns", then set candidate prefix to "xmlns".
                    -
                  5. Otherwise, attribute namespace in not the XMLNS namespace. Run - these steps: +
                  6. Otherwise (attribute namespace is not the XMLNS namespace):
                    1. Set candidate prefix to the result of generating a prefix given map, attribute namespace, and prefix index. @@ -1014,8 +1037,8 @@

                      Extensibility

                    2. 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.
                    3. Append the following to result, in the order listed:
                        @@ -1040,13 +1063,14 @@

                        Extensibility

                        1. 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.
                        2. If attribute value is null, then return the empty string. -
                        3. Otherwise, attribute value is a string. Return attribute value, first - replacing any occurrences of the following: +
                        4. Otherwise, return attribute value, first replacing any occurrences of the + following:
                          1. "&" with "&amp;" @@ -1101,8 +1125,8 @@

                            Extensibility

                            1. 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.
                            2. Otherwise:
                                @@ -1140,8 +1164,8 @@

                                Extensibility

                              1. 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.
                              2. Otherwise, return the concatenation of "<!--", node's [=CharacterData/data=], and "-->". @@ -1184,8 +1208,8 @@

                                Extensibility

                                1. 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.
                                2. Let markup be node's [=CharacterData/data=]. @@ -1245,14 +1269,14 @@

                                  Extensibility

                                  1. 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.
                                  2. 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.
                                  3. Let markup be the empty string. @@ -1260,8 +1284,9 @@

                                    Extensibility

                                  4. Append " " (U+0020 SPACE) to markup. -
                                  5. Append node's [=DocumentType/name=] to markup. For a node - belonging to an HTML document, the value will be all lowercase. +
                                  6. Append node's [=DocumentType/name=] to markup. + For a node belonging to an HTML document, the + name will be all lowercase.
                                  7. 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

                                  8. 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.
                                  9. 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.
                                  10. 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

                                    1. [=list/For each=] attr of element's [=Element/attribute list=]:
                                        -
                                      1. 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. +
                                      2. Let attribute namespace be attr's [=Attr/namespace=]. -
                                      3. Create a new tuple consisting of attr's [=Attr/namespace=] and - [=Attr/local name=], and add it to localname set. +
                                      4. Let |attrName| be a new tuple (|attribute namespace|, attr's + [=Attr/local name=]). -
                                      5. Let attribute namespace be attr's [=Attr/namespace=]. +
                                      6. 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. + +
                                      7. [=set/Append=] |attrName| to localname set.
                                      8. 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

            3. -

              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:
                  -
                1. 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. -
                2. Let markup be node's [=CharacterData/data=]. +
                3. 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. +
                4. Replace any occurrences of "&" in markup by "&amp;". From dbaa86a0a38f5b4909bcb1f261ca043a91d40f50 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: 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.

                  +
                  +
                  1. Append the concatenation of candidate prefix, ":" (U+003A COLON), and node's [=Element/local name=] to qualified name. @@ -1108,6 +1110,8 @@

                    Extensibility

              +
              +
  • @@ -1324,6 +1328,7 @@

    Extensibility

  • """ (U+0022 QUOTATION MARK). +
    + require well-formed.
    {{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: Ms2ger Date: 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 "&lt;" -
  • ">" with "&gt;" +
  • U+0009 CHARACTER TABULATION with "&#9;" + +
  • U+000A LINE FEED (LF) with "&#xA;" + +
  • U+000D CARRIAGE RETURN (CR) with "&#xD;"

    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

    1. " " (U+0020 SPACE); -
    2. """ (U+0022 QUOTATION MARK); - -
    3. node's [=DocumentType/system ID=]; - -
    4. """ (U+0022 QUOTATION MARK). +
    5. the [=serialization of the ID=] node's [=DocumentType/system ID=].
    -

    XML serializing a ProcessingInstruction node