From 39e6a33785b33649ef839d8ad355461a57413963 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 4 Aug 2015 13:14:08 +0200 Subject: [PATCH] Make cloning more explicit regarding attributes. Fixes #30. --- dom.bs | 68 ++++++++++++++++++++---------------------- dom.html | 90 +++++++++++++++++++++++++++++--------------------------- 2 files changed, 78 insertions(+), 80 deletions(-) diff --git a/dom.bs b/dom.bs index 29a7acde..27fae2af 100644 --- a/dom.bs +++ b/dom.bs @@ -3459,40 +3459,34 @@ run these steps: dom-Range-extractContents, dom-Range-cloneContents -->
    -
  1. If document is not given, let document be - node's node document. - -
  2. Let copy be a node - that implements the same interfaces as node. +
  3. If document is not given, let document be node's + node document.

  4. - If copy is a - document, set its - node document and - document to copy. - Otherwise, set copy's - node document to - document. +

    Let copy be a node that implements the same interfaces as + node, and fulfills these additional requirements, switching on + node: -

  5. - Copy the following from node to copy, depending on - the type of node:
    {{Document}} -
    Its encoding, - content type, - URL, type, and mode. +
    +

    Set copy's encoding, + content type, URL, type, + and mode, to those of node.

    {{DocumentType}} -
    Its name, - public ID, and - system ID. +

    Set copy's name, public ID, and + system ID, to those of node.

    {{Element}} -
    Its namespace, - namespace prefix, - local name, and its - attribute list. +
    +

    Set copy's namespace, + namespace prefix, and local name, to those of + node. + +

    For each attribute in node's attribute list, + in order, append a copy to copy's + attribute list.

    {{Text}}
    {{Comment}} -
    Its data. +
    Set copy's data, to that of node.
    {{ProcessingInstruction}} -
    Its target and data. +
    Set copy's target and data to + those of node.
    Any other node
    -
  6. Run any cloning steps - defined for node in other applicable specifications and - pass copy, node, document and the - clone children flag if set, as parameters. +
  7. Set copy's node document and document to + copy, if copy is a document, and set copy's + node document to document otherwise. + +

  8. Run any cloning steps defined for node in + other applicable specifications and pass copy, node, + document and the clone children flag if set, as parameters. -
  9. If the clone children flag is set, - clone all the - children of node and - append them to copy, with document - as specified and the clone children flag being set. +
  10. If the clone children flag is set, clone all the + children of node and append them to copy, with + document as specified and the clone children flag being set.
  11. Return copy.
diff --git a/dom.html b/dom.html index eb085fba..d59aac71 100644 --- a/dom.html +++ b/dom.html @@ -88,7 +88,7 @@

DOM

Living Standard — Last Updated -

+
@@ -4525,64 +4525,63 @@

node document. - - -
  • Let copy be a node - that implements the same interfaces as node. - -
  • - If copy is a - document, set its - node document and - document to copy. - Otherwise, set copy’s - node document to - document. +

    If document is not given, let document be node’s + node document. - +

  • - Copy the following from node to copy, depending on - the type of node: +

    Let copy be a node that implements the same interfaces as + node, and fulfills these additional requirements, switching on + node: + +

    Document -
    Its encoding, - content type, - URL, type, and mode. +
    + +

    Set copy’s encoding, + content type, URL, type, + and mode, to those of node. - +

    DocumentType -
    Its name, - public ID, and - system ID. +
    +

    Set copy’s name, public ID, and + system ID, to those of node. - +

    Element -
    Its namespace, - namespace prefix, - local name, and its - attribute list. +
    + +

    Set copy’s namespace, + namespace prefix, and local name, to those of + node. - +

    +

    For each attribute in node’s attribute list, + in order, append a copy to copy’s + attribute list. + +

    Text
    Comment -
    Its data. +
    Set copy’s data, to that of node.
    ProcessingInstruction -
    Its target and data. +
    Set copy’s target and data to + those of node.
    Any other node @@ -4593,17 +4592,20 @@

    cloning steps - defined for node in other applicable specifications and - pass copy, node, document and the - clone children flag if set, as parameters. +
  • +

    Set copy’s node document and document to + copy, if copy is a document, and set copy’s + node document to document otherwise. + +

    +
  • Run any cloning steps defined for node in + other applicable specifications and pass copy, node, + document and the clone children flag if set, as parameters. -
  • If the clone children flag is set, - clone all the - children of node and - append them to copy, with document - as specified and the clone children flag being set. +
  • If the clone children flag is set, clone all the + children of node and append them to copy, with + document as specified and the clone children flag being set.
  • Return copy. @@ -5766,7 +5768,7 @@

    context object.

    -
    +
    Given the following XHTML fragment: