TreeWalker.lastChild()
La méthode TreeWalker.lastChild()
déplace le Node
courant au dernier enfant visible du noeud courant et renvoie l'enfant trouvé. Il déplace aussi le noeud courant vers cet enfant. Si aucun enfant n'existe, elle retourne null
et le noeud courant reste inchangé.
Syntaxe
node = treeWalker.lastChild();
Exemple
var treeWalker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
false
);
var node = treeWalker.lastChild(); // renvoie le dernier enfant visible de l'élément racine
Spécifications
Spécification | Statut | Commentaire |
---|---|---|
DOM La définition de 'TreeWalker.lastChild' dans cette spécification. |
Standard évolutif | Pas de changement de Document Object Model (DOM) Level 2 Traversal and Range Specification |
Document Object Model (DOM) Level 2 Traversal and Range Specification La définition de 'TreeWalker.lastChild' dans cette spécification. |
Obsolete | Définition initiale. |
Compatibilité des navigateurs
BCD tables only load in the browser
Voir aussi
- L'interface
TreeWalker
à laquelle elle appartient.