diff --git a/dom.bs b/dom.bs index d5beb1fa..3a38ce3f 100644 --- a/dom.bs +++ b/dom.bs @@ -3448,14 +3448,13 @@ standards that want to define APIs shared between documents and strings nodes, and document document:
    -
  1. Replace each string of nodes with a new {{Text}} node whose - data is the string and node document is - document. +

  2. Replace each string in nodes with the result of creating a text node given + document and the string.

  3. If nodes's size is 1, then return nodes[0]. -

  4. Let fragment be a new {{DocumentFragment}} node whose - node document is document. +

  5. Let fragment be the result of creating a document fragment given + document.

  6. For each node of nodes: append node to fragment. @@ -4508,6 +4507,21 @@ get a direct instance of it.

    Each node also has a registered observer list. +

    +

    To create a node that implements an interface interface, given a +document document: + +

      +
    1. Assert: interface is neither {{Document}} nor an interface that + inherits from {{Document}}. To create a document, use + create a document instead. + +

    2. Return a new node that implements interface, in + document's relevant realm, with its node document set to + document. +

    +
    +
    @@ -4797,9 +4811,9 @@ return the result of running get text content with this.
    1. Let node be null. -

    2. If string is not the empty string, then set node to a new {{Text}} - node whose data is string and - node document is parent's node document. +

    3. If string is not the empty string, then set node to the result of + creating a text node given parent's node document and + string.

    4. Replace all with node within parent.

    @@ -5021,10 +5035,16 @@ and an optional document docume
+
  • Otherwise, if node is a document, set copy to the result + of creating a document that implements the same interfaces as node, given + document's relevant realm. + +

  • Otherwise, set copy to the result of creating a node that + implements the same interfaces as node, given document. +

  • -

    Otherwise, set copy to a node that implements the same - interfaces as node, and fulfills these additional requirements, switching on the - interface node implements: +

    Fulfill these additional requirements, switching on the interface node + implements:

    {{Document}} @@ -5642,6 +5662,19 @@ null if event's {{Event/type}} attribute value is "load" document does not have a browsing context; otherwise the document's relevant global object. +
    +

    To create a document that implements an interface interface, +given a realm realm: + +

      +
    1. Assert: interface is {{Document}} or an interface that inherits from + {{Document}}. + +

    2. Return a new node that implements interface, in + realm. +

    +
    +
    @@ -5987,12 +6020,10 @@ parameter is allowed to be a string for web compatibility.

    The createDocumentFragment() method steps are to -return a new {{DocumentFragment}} node whose node document is -this. +return the result of creating a document fragment given this.

    The createTextNode(data) method steps are -to return a new {{Text}} node whose data is data -and node document is this. +to return the result of creating a text node given this and data.

    The createCDATASection(data) method steps are: @@ -6004,27 +6035,21 @@ are:

  • If data contains the string "]]>", then throw an "{{InvalidCharacterError!!exception}}" {{DOMException}}. -

  • Return a new {{CDATASection}} node with its data set - to data and node document set to this. +

  • Let node be the result of creating a node that implements + {{CDATASection}}, given this. + +

  • Set node's data to data. + +

  • Return node. -

    The createComment(data) method steps are -to return a new {{Comment}} node whose data is data -and node document is this. +

    The createComment(data) method steps are to +return the result of creating a comment node given this and data.

    The createProcessingInstruction(target, data) -method steps are: - -

      -
    1. Let pi be a new {{ProcessingInstruction}} - node, with node document set to this. - -

    2. Initialize pi with target and - data. - -

    3. Return pi. -

    +method steps are to return the result of creating a processing instruction node given +this, target, and data.
    @@ -6216,8 +6241,7 @@ steps are:
  • If this is an HTML document, then set localName to localName in ASCII lowercase. -
  • Return a new attribute whose local name is localName and - node document is this. +
  • Return the result of creating an attribute given this and localName.

    The @@ -6229,9 +6253,8 @@ method steps are: [=validate and extract|validating and extracting=] namespace and qualifiedName given "attribute". -

  • Return a new attribute whose namespace is namespace, - namespace prefix is prefix, local name is - localName, and node document is this. +

  • Return the result of creating an attribute given this, localName, + namespace, and prefix.


    @@ -6403,10 +6426,8 @@ method steps are:
  • If name is not a valid doctype name, then throw an "{{InvalidCharacterError}}" {{DOMException}}. -

  • Return a new doctype, with name as its - name, publicId as its public ID, and systemId - as its system ID, and with its node document set to the associated - document of this. +

  • Return the result of creating a doctype given the associated document of + this, name, publicId, and systemId.

    The @@ -6414,7 +6435,8 @@ method steps are: method steps are:

      -
    1. Let document be a new {{XMLDocument}}. +

    2. Let document be the result of creating a document that implements + {{XMLDocument}}, given this's relevant realm.

    3. Let element be null. @@ -6451,13 +6473,16 @@ method steps are: method steps are:

        -
      1. Let doc be a new document that is an HTML document. +

      2. Let doc be the result of creating a document that implements + {{Document}}, given this's relevant realm. + +

      3. Set doc's type to "html" and + content type to "text/html". -

      4. Set doc's content type to "text/html". +

      5. Let doctype be the result of creating a doctype given doc and + "html". -

      6. Append a new doctype, with "html" as its - name and with its node document set to doc, to - doc. +

      7. Append doctype to doc.

      8. Append the result of creating an element given doc, "html", and the HTML namespace, to doc. @@ -6472,9 +6497,10 @@ method steps are:

      9. Append the result of creating an element given doc, "title", and the HTML namespace, to the <{head}> element created earlier. -

      10. Append a new {{Text}} node, with its data set - to title (which could be the empty string) and its node document set - to doc, to the <{title}> element created earlier. +

      11. Let text be the result of creating a text node given doc and + title (which could be the empty string). + +

      12. Append text to the <{title}> element created earlier.

    4. Append the result of creating an element given doc, @@ -6511,13 +6537,25 @@ interface DocumentType : Node { doctypes.

      Doctypes have an associated -name, -public ID, and -system ID. +name (a string), +public ID (a string), and +system ID (a string). + +

      +

      To create a doctype given a document document, a string +name, and optionally a string publicId (default the empty string) and a string +systemId (default the empty string): -

      When a doctype is created, its name is always given. Unless -explicitly given when a doctype is created, its public ID and system ID are the -empty string. +

        +
      1. Let doctype be the result of creating a node that implements + {{DocumentType}}, given document. + +

      2. Set doctype's name to name, public ID to + publicId, and system ID to systemId. + +

      3. Return doctype. +

      +

      The name getter steps are to return this's name. @@ -6567,7 +6605,11 @@ or if B's root has a non-null element and for shadow roots, and impacts the pre-insert and replace algorithms. -


      +
      +

      To create a document fragment given a document +document: return the result of creating a node that implements +{{DocumentFragment}}, given document. +

      The @@ -7083,13 +7125,15 @@ a string-or-null prefix, a string state, a string-or-null null or a {{CustomElementRegistry}} object registry:

        -
      1. Let element be a new element that implements interface, - with namespace set to namespace, namespace prefix - set to prefix, local name set to localName, - custom element registry set to registry, - custom element state set to state, - custom element definition set to null, is value - set to is, and node document set to document. +

      2. Let element be the result of creating a node that implements + interface, given document. + +

      3. Set element's namespace to namespace, + namespace prefix to prefix, local name to + localName, custom element registry to registry, + custom element state to state, + custom element definition to null, and is value + to is.

      4. Assert: element's attribute list is empty. @@ -7291,12 +7335,10 @@ an optional null or string prefix (default null), and an optional nul getting an attribute given namespace, localName, and element. -

      5. If attribute is null, create an attribute whose namespace is - namespace, namespace prefix is prefix, - local name is localName, value is value, and - node document is element's node document, then - append this attribute to element, and then - return. +
      6. If attribute is null, then append the result of + creating an attribute given element's node document, + localName, namespace, prefix, and value to + element, and then return.
      7. Change attribute to value.

      @@ -7581,9 +7623,8 @@ method steps are:
    5. If attribute is non-null, then change attribute to verifiedValue and return. -

    6. Set attribute to a new attribute whose local name is - qualifiedName, value is verifiedValue, and - node document is this's node document. +

    7. Set attribute to the result of creating an attribute given this's + node document, qualifiedName, null, null, and verifiedValue.

    8. Append attribute to this.

    @@ -7662,11 +7703,9 @@ method steps are:

    If attribute is null:

      -
    1. If force is not given or is true, create an attribute whose - local name is qualifiedName, value is the empty - string, and node document is this's node document, then - append this attribute to this, and then return - true. +

    2. If force is not given or is true, then append + the result of creating an attribute given this's node document and + qualifiedName to this, and then return true.

    3. Return false.

    @@ -7853,9 +7892,12 @@ a boolean serializable, a boolean delegatesFocus, a string -
  • Let shadow be a new shadow root whose node document - is element's node document, host is - element, and mode is mode. +

  • Let shadow be the result of creating a node that implements + {{ShadowRoot}}, given element's node document. + +

  • Set shadow's host to element. + +

  • Set shadow's mode to mode.

  • Set shadow's delegates focus to delegatesFocus. @@ -8013,9 +8055,8 @@ method steps are to return the result of running insert adjacent, give -

  • Let text be a new {{Text}} node whose data - is data and node document is this's - node document. +

  • Let text be the result of creating a text node given this's + node document and data.

  • Run insert adjacent, given this, where, and text. @@ -8177,13 +8218,23 @@ to as content attributes to avoid confusion with IDL attributes.

    User agents could have this as an internal slot as an optimization. -

    When an attribute is created, its -local name is given. Unless explicitly -given when an attribute is created, its -namespace, -namespace prefix, and -element are set to null, and its -value is set to the empty string. +

    +

    To create an attribute given a document document, a +string localName, and optionally a string-or-null namespace (default null), a +string-or-null prefix (default null), and a string value (default the empty +string): + +

      +
    1. Let attribute be the result of creating a node that implements {{Attr}}, + given document. + +

    2. Set attribute's namespace to namespace, + namespace prefix to prefix, local name to + localName, and value to value. + +

    3. Return attribute. +

    +

    An A attribute @@ -8477,6 +8528,20 @@ the {{Text}} node children of node, in < node, in tree order. +

    +

    To create a text node given a document document and a +string data: + +

      +
    1. Let text be the result of creating a node that implements {{Text}}, given + document. + +

    2. Set text's data to data. + +

    3. Return text. +

    +
    +
    @@ -8501,9 +8566,8 @@ constructor steps are to set this's data to

    Let newData be the result of substringing data of node with offset and count. -

  • Let newNode be a new {{Text}} node whose - node document is node's node document and - data is newData. +

  • Let newNode be the result of creating a text node given node's + node document and newData.

  • Let parent be node's parent. @@ -8626,6 +8690,21 @@ interface ProcessingInstruction : CharacterData { attribute map, which is a map, initially empty. +

    +

    To create a processing instruction node given a document +document, a string target, and a string data: + +

      +
    1. Let pi be the result of creating a node that implements + {{ProcessingInstruction}}, given document. + +

    2. Initialize pi with target and + data. + +

    3. Return pi. +

    +
    +

    To initialize a {{ProcessingInstruction}} node pi, with target and data: @@ -8829,6 +8908,20 @@ interface Comment : CharacterData { data is data.

  • +
    +

    To create a comment node given a document document and +a string data: + +

      +
    1. Let comment be the result of creating a node that implements {{Comment}}, + given document. + +

    2. Set comment's data to data. + +

    3. Return comment. +

    +
    +

    The new Comment(data) constructor steps are to set this's data to data and @@ -9594,9 +9687,8 @@ method steps are: range:

      -
    1. Let fragment be a new {{DocumentFragment}} node whose - node document is range's start node's - node document. +

    2. Let fragment be the result of creating a document fragment given + range's start node's node document.

    3. If range is collapsed, then return fragment.