W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011


From: Ralph Ritoch <rritoch@gmail.com>
Date: Sat, 22 Jan 2011 20:06:21 -0700
Message-ID: <AANLkTimPZucCQHYJTXQuG43c-mQaFAgSih_pyukF+bzy@mail.gmail.com>
To: public-webapps@w3.org
I would like to submit to you a possible addition to the DOM specification
based on discoveries I made while developing a new protocol named XRDOM.

The addition is a method named takeChildNodes which should be added to the
Node interface. This method makes it more possible to easily move data
around the document with linear code that does not require any flow control
statements (loops). One example would be to move a nodes children to its
parent node and then remove the node itself. I have been using this method
to replace an element with another element, including the attributes while
not affecting the position of the hostNodes child nodes in the document.
The takeChildNodes method can also be used in conjunction with the cloneNode
function to copy attribute values or to provide more easily cut,copy, and
paste functionality.  The takeChildNodes method returns the node itself for
convenience and must remove the nodes from the hostNode, as cloneNode can be
used in conjunction for the purpose of copying only the child nodes.

See related XRDOM Notes:



  interface Node


    Node <http://dev.w3.org/2006/webapi/DOM4Core/DOM4Core.html#interface-node>


This method removes all child nodes from the provided hostNode and appends
them to the end of the list of children of this node in the same order they
were in the original hostNode. This method does not remove Attr nodes and
does not move Attr nodes to the current node.

hostNode of type NodeThe Node to remove children from.
*Return Value*


The current Node which now has the child nodes from the hostNode.

DOMException <http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-17189187>

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow
children of the type of the node(s) received from the hostNode, or if the
node to append is one of this node's
this node itself, or if this node is of type
the DOM application attempts to append a second
 or Element <http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614>

WRONG_DOCUMENT_ERR: Raised if a hostNode was created from a different
document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the
previous parent of the node being inserted is readonly.

NOT_SUPPORTED_ERR: this exception might be raised if the DOM implementation
doesn't support the moving of the
or Element <http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614>


Please send any issues related to this suggestion to rritoch@gmail.com .

Best Regards,
 Ralph Ritoch
Received on Sunday, 23 January 2011 13:39:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:16 UTC