Properties and methods of text objects

Each contiguous block of text in an HTML document (for example, the text within a P tag) is represented by a JavaScript object. Text objects never have children. The following table describes the properties and methods of text objects that are taken from DOM Level 1 and used in Adobe Dreamweaver. A bullet () marks read-only properties.

Property or method

Return value

nodeType 

Node.TEXT_NODE

parentNode 

The parent tag

childNodes 

An empty NodeList

data

The actual text string. Entities in the text are represented as a single character (for example, the text Joseph & I is returned as Joseph & I).

hasChildNodes()
false