IN FIREFOX, first and last chilren of DOM elements (html, head, body, and others) are text nodes. In the example below they are represented as (#text). This is very important!. Suppose that we have
<head>
<title>Deneme</title>
</head>
To get the Title node, we should write a code like:
var titleNode1 = headNode.firstChild.nextSibling;
// or
var titleNode2 = headNode.childNodes[1];
document
|----- html (element)
|
|----- (#text)
|
|----- head (element)
| |
| |----- (#text)
| |
| |----- title (element)
| | |
| | |----- (#text)
| |
| |----- (#text)
|
|----- (#text)
|
|----- body (element)
| |
| |----- (#text)
| |
| |----- p (element)
| | |
| | |----- (#text)
| | |
| | |----- i(element)
| | | |
| | | |----- (#text)
| | |
| | |----- (#text)
| |
| |----- (#text)
|
|----- (#text)
Hiç yorum yok:
Yorum Gönder