Name

Node

Synopsis

The granddaddy of much of the DOM, the Node class carries quite a lot of information.

Node Constants

Node defines several constants that can be used by application writers to determine the node’s nodeType.

ELEMENT_NODE

An Element node

ATTRIBUTE_NODE

An Attr node

TEXT_NODE

A Text node

CDATA_SECTION_NODE

A CDATASection node

ENTITY_REFERENCE_NODE

An EntityReference node

ENTITY_NODE

An Entity node

PROCESSING_INSTRUCTION_NODE

A ProcessingInstruction node

COMMENT_NODE

A Comment node

DOCUMENT_NODE

A Document node

DOCUMENT_TYPE_NODE

A DocumentType node

DOCUMENT_FRAGMENT_NODE

A DocumentFragment node

NOTATION_NODE

A Notation node

Node Properties and Methods

attributes

This contains a NamedNodeMap that contain the attributes of this node, or the value is None.

childNodes

This contains a NodeList containing all children of this node. If no children exist then the list is empty.

firstChild

The first child of the node. A convenient attribute if you know the structure of the document. If the node has no children, this is None.

lastChild

Similar to its counterpart firstChild, but returns the last child node. If the node has no children, this is None.

localName

Returns the local part of the qualified name of the node.

namespaceURI

The namespace URI of the node or None if none exists.

nextSibling

The node immediately following this node or None if none exists.

nodeName

The name of the node, depending on its type. nodes of type Text and CharacterData do not have their own names, but rather just a string indicating that they are that specific type. For Element nodes, it’s the tag name. For other named types, it returns their respective names.

nodeType

An integer representing the type of the node. This is directly correlated to the defined constants of the Node class.

nodeValue

The value of this node depending on its type. For attributes, it is the assigned value. For CDATASection, Comment, Text, and ProcessingInstruction nodes, it is their contents respectively. However, for Element nodes, this value is not the character data beneath the element, but None.

ownerDocument

The Document object to which this node belongs.

parentNode

The immediate parent of the node. This may be None if the node has just been created and has not been inserted as a child of another node. This is always None for attribute nodes.

prefix

This is the namespace prefix, or None if the node does not have a namespace prefix.

previousSibling

Similar to nextSibling, this attribute is associated with the node immediately preceding this one, or None.

appendChild( newChild )

This method adds the newChild node the end of the NodeList contained within this node. If the node already exists, it is removed and then added back.

cloneNode( deep )

This method returns a duplicate of the node. The duplicate node is not attached, and does not have a parent. The deep parameter, if true, indicates that the entire tree beneath this node should be included in the copy operation.

hasChildNodes( )

Boolean method returns true or false depending on whether the node has children.

insertBefore( newChild, refChild )

Inserts the new node immediately prior to the refChild within the node’s NodeList. If the newChild already exists within the list, it is deleted first and added again.

supports( feature, level )

This method returns true or false depending on whether the DOM implementation supports a specific feature for this particular node.

normalize( )

This method descends to the full depth beneath this node, and ensures that only markup structure such as elements, comments, and processing instructions separate Text nodes. This eliminates empty (or whitespace) nodes existing in between chunks of text in your markup.

removeChild( childNode )

Returns and removes the childNode from the node’s NodeList.

replaceChild( newChild, oldChild )

Replaces oldChild with newChild and returns oldChild to the caller. If newChild is already a child of some element, it is removed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.123.106