|
Figure 5.9:
DOM tree before normalize().
Figure 5.10 Pdf ko'rish
|
bet | 120/131 | Sana | 14.05.2024 | Hajmi | 2,96 Mb. | | #232039 |
Bog'liq Ceponkus, Hoodbhoy - Applied XML - Toolkit for ProgrammersFigure 5.9:
DOM tree before normalize().
Figure 5.10:
DOM tree after normalize().
Element Usage Examples
The following are several examples of element usage.
Iterating through Children
Often it is necessary to perform some sort of action to every child of a node. Using the
childNodes collection and a for loop, visiting each child is quite easy. The start() method
is automatically called when the document is loaded because of the onload event on the
tag. The function then visits each child node to check if it’s an Element node. If
so, the tag name is displayed. A true iterating facility would indeed be a nice addition to
the DOM specification. For those who are unfamiliar with iterators, an iterator facility
would allow a programmer to ask for the next child through a method instead of with
indexes.
| onload="start()"
>
| |