diff --git a/index.html b/index.html index ab34e3d..7263b57 100644 --- a/index.html +++ b/index.html @@ -244,15 +244,15 @@ ] } ], - "publishISODate": "2024-04-19T00:00:00.000Z", - "generatedSubtitle": "W3C Editor's Draft 19 April 2024" + "publishISODate": "2024-04-24T00:00:00.000Z", + "generatedSubtitle": "W3C Editor's Draft 24 April 2024" }

DOM Parsing and Serialization

DOMParser, XMLSerializer, innerHTML, and similar APIs

-

W3C Editor's Draft

+

W3C Editor's Draft

More details about this document
@@ -350,7 +350,7 @@

DOM Parsing and Serialization

03 November 2023 W3C Process Document. -

+

Candidate Recommendation Exit Criteria

@@ -481,7 +481,7 @@

DOM Parsing and Serialization

// "<root><script xmlns="http://www.w3.org/1999/xhtml">alert('hello world')</script></root>"

-

The term context object means the object on which the API being discussed was +

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 @@ -562,73 +562,12 @@

DOM Parsing and Serialization

2.5 Extensions to the Range interface

+

2.5 Extensions to the Range interface

-
WebIDLpartial interface Range {
-  [CEReactions, NewObject] DocumentFragment createContextualFragment(HTMLString fragment);
-};
- -
-
docFragment = range . createContextualFragment ( fragment ) -
Returns a DocumentFragment, created from the markup string - fragment using range's start node as the context in which - fragment is parsed. -
- -

The createContextualFragment(fragment) method - must run these steps: - -

    -
  1. Let node be the context object's start node. - -

    Let element be as follows, depending on node's interface: - -

    -
    Document -
    DocumentFragment -
    null - -
    Element -
    node - -
    Text -
    Comment -
    node's parent element - -
    DocumentType -
    ProcessingInstruction -
    [DOM4] prevents this case. -
    - -
  2. If either element is null or the following are all true: - - - -

    let element be a new Element with - -

    +

    The definition of createContextualFragment has moved to the HTML Standard.

    -
  3. Let fragment node be the result of invoking the fragment parsing algorithm - with fragment as markup, and element as the - context element. - -
  4. Unmark all scripts in fragment node as "already started" and as "parser-inserted". - -
  5. Return the value of fragment node. -
@@ -657,20 +596,20 @@

DOM Parsing and Serialization

XML serialization differs from an HTML serialization in the following ways:

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 + HTML namespace that contain no child nodes are serialized with an explicit begin and end tag rather than using the empty-element tag syntax.

Note

Per [DOM4], Attr objects do not inherit from Node, and @@ -683,9 +622,9 @@

DOM Parsing and Serialization

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 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 + the Element Node to match its own namespace. The algorithm assumes no namespace (null) to start.
  • Let prefix map be a new namespace prefix map. @@ -725,27 +664,27 @@

    DOM Parsing and Serialization

    -
    Element +
    Element
    Run the algorithm for XML serializing an Element node node. -
    Document +
    Document
    Run the algorithm for XML serializing a Document node node. -
    Comment +
    Comment
    Run the algorithm for XML serializing a Comment node node. -
    Text +
    Text
    Run the algorithm for XML serializing a Text node node. -
    DocumentFragment +
    DocumentFragment
    Run the algorithm for XML serializing a DocumentFragment node node. -
    DocumentType +
    DocumentType
    Run the algorithm for XML serializing a DocumentType node node. -
    ProcessingInstruction +
    ProcessingInstruction
    Run the algorithm for XML serializing a ProcessingInstruction node node.
    An Attr object @@ -760,7 +699,7 @@

    DOM Parsing and Serialization

    3.2.1.1 XML serializing an Element node
    - The algorithm for producing an XML serialization of a DOM node of type Element is as + The algorithm for producing an XML serialization of a DOM node of type Element is as follows:
      @@ -793,7 +732,7 @@

      DOM Parsing and Serialization

      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 + 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 @@ -844,7 +783,7 @@

    DOM Parsing and Serialization

    require well-formed flag is set, then throw an error. An - Element with prefix "xmlns" + Element with prefix "xmlns" will not legally round-trip in a conforming XML parser.

  • Let candidate prefix be the value of prefix. @@ -854,7 +793,7 @@

    DOM Parsing and Serialization

    Note

    The following may serialize a different - prefix than the Element's existing + 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 prefix if possible.

    @@ -988,7 +927,7 @@

    DOM Parsing and Serialization

    ignore namespace definition attribute flag, and require well-formed flag. -

  • If ns is the HTML namespace, and the node's list of +
  • If ns is the HTML namespace, and the node's list of children is empty, and the node's localName matches any one of the following void elements: "area", @@ -1018,7 +957,7 @@

    DOM Parsing and Serialization

    skip end tag flag to true. -

  • If ns is not the HTML namespace, and the node's list of +
  • 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. @@ -1027,11 +966,11 @@

    DOM Parsing and Serialization

    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 +
  • If ns is the HTML namespace, and the node's 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 + template contents (a DocumentFragment), providing inherited ns, map, prefix index, and the require well-formed flag. @@ -1062,7 +1001,7 @@

    DOM Parsing and Serialization

    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), the user agent must run the following steps: @@ -1219,7 +1158,7 @@

    DOM Parsing and Serialization

    3.2.1.1.3 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, a local prefixes map, a ignore namespace definition attribute flag, and a @@ -1278,7 +1217,7 @@

    DOM Parsing and Serialization

    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 should be skipped);

  • the attr's prefix is not null and either - - The Trusted Types [TRUSTED-TYPES] specification defines: - -

    B. Revision History

    @@ -1801,12 +1734,8 @@

    DOM Parsing and Serialization

    DOM Standard. Anne van Kesteren. WHATWG. Living Standard. URL: https://dom.spec.whatwg.org/
    [ECMA-262]
    ECMAScript Language Specification. Ecma International. URL: https://tc39.es/ecma262/multipage/ -
    [html]
    - HTML Standard. Anne van Kesteren; Domenic Denicola; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL: https://html.spec.whatwg.org/multipage/
    [HTML5]
    HTML5. Ian Hickson; Robin Berjon; Steve Faulkner; Travis Leithead; Erika Doyle Navara; Theresa O'Connor; Silvia Pfeiffer. W3C. 27 March 2018. W3C Recommendation. URL: https://www.w3.org/TR/html5/ -
    [TRUSTED-TYPES]
    - Trusted Types. Krzysztof Kotowicz. W3C. 27 September 2022. W3C Working Draft. URL: https://www.w3.org/TR/trusted-types/
    [WEBIDL]
    Web IDL Standard. Edgar Chen; Timothy Gu. WHATWG. Living Standard. URL: https://webidl.spec.whatwg.org/
    [XML10]
    @@ -1870,10 +1799,8 @@

    DOM Parsing and Serialization

    § 2.5 Extensions to the Range interface (2) -

  • - +
  • Not referenced in this document.
  • +