Note: Internet Explorer will skip white-space text
node that are generated between nodes (e.g. new-line
characters), while Mozilla will not. So, in the example above,
the get_lastchild() function check the node type of the last
child node of the parameter.
Element nodes has the nodeType of 1, so if not the last child of
the node in the parameter is an element node, it moves to the
previous node, and checks if this node is an element node. This
continues until the last child node (which must be the element
node) is found. This way, the result will be correct in both
Mozilla and Internet Explorer .
|