UIZE JavaScript Framework

MODULES Uize.Dom.Text

1. Introduction

The Uize.Dom.Text module provides a method for getting the text content of DOM nodes.

DEVELOPERS: Chris van Rensburg

1.1. Examples

There are no dedicated showcase example pages for the Uize.Dom.Text module.

SEARCH FOR EXAMPLES

Use the link below to search for example pages on the UIZE Web site that reference the Uize.Dom.Text module...

SEARCH

1.2. Implementation Info

The Uize.Dom.Text module defines the Uize.Dom.Text package under the Uize.Dom namespace.

1.2.1. Features Introduced in This Module

The features listed in this section have been introduced in this module.

STATIC METHODS

Uize.Dom.Text.getText

STATIC PROPERTIES

Uize.Dom.Text.moduleName | Uize.Dom.Text.pathToResources

1.2.2. Features Overridden in This Module

No features have been overridden in this module.

1.2.3. Features Inherited From Other Modules

This module has no inherited features.

1.2.4. Modules Directly Under This Namespace

There are no modules directly under this namespace.

1.2.5. Unit Tests

There is no dedicated unit tests module for the Uize.Dom.Text module.

2. Static Methods

2.1. Uize.Dom.Text.getText

Returns a string, representing the text content of the specified node.

SYNTAX

nodeTextSTR = Uize.Dom.Text.getText (nodeSTRorOBJ);

In Internet Explorer, this method employs the innerText property, removing all linebreaks. In other browsers that support the textContent property, this is used. For browsers that support neither, this method iterates recursively through the child nodes and cumulatively harvests the text content using the data property of all the text nodes.

EXAMPLE

<div id="testNode">
  <p>This is a test</p>
  <table>
    <tr>
      <td> of</td>
      <td> the</td>
    </tr>
  </table>
  <blockquote>
    <ul>
      <li> emergency
      <li> broadcasting
    </ul>
    <p> network</p>
  </blockquote>
</div>

In the above example, the statement Uize.Dom.Text.getText ('testNode') would return roughly 'this is a test of the emergency broadcasting network' (between browsers there might be variability with the whitespace content).

NOTES

this method is not quaranteed to return exactly the same value for the exact same markup in all browsers

IMPLEMENTATION INFO

this feature was introduced in this module

3. Static Properties

3.1. Uize.Dom.Text.moduleName

IMPLEMENTATION INFO

this feature was introduced in this module

3.2. Uize.Dom.Text.pathToResources

IMPLEMENTATION INFO

this feature was introduced in this module