Section 25.77. Document.importNode( ): copy a node from another document for use in this document


25.77. Document.importNode( ): copy a node from another document for use in this document

DOM Level 2 Core:

25.77.1. Synopsis

 Node importNode(Node importedNode,                 boolean deep)     throws DOMException; 

25.77.1.1. Arguments

importedNode

The node to be imported.


deep

If TRue, recursively copy all descendants of importedNode as well.

25.77.1.2. Returns

A copy of importedNode (and possibly all of its descendants) with its ownerDocument set to this document.

25.77.1.3. Throws

This method throws a DOMException with a code of NOT_SUPPORTED_ERR if importedNode is a Document or DocumentType node, because those types of nodes cannot be imported.

25.77.2. Description

This method is passed a node defined in another document and returns a copy of the node that is suitable for insertion into this document. If deep is TRue, all descendants of the node are also copied. The original node and its descendants are not modified in any way. The returned copy has its ownerDocument property set to this document but has a parentNode of null because it has not yet been inserted into the document. Event-listener functions registered on the original node or tree are not copied.

When an Element node is imported, only the attributes that are explicitly specified in the source document are imported with it. When an Attr node is imported, its specified property is automatically set to TRue.

25.77.3. See Also

Node.cloneNode( )




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net