StringBuilder result;
result.reserveCapacity(1024);
- for (Node* n = node->firstChild(); n; n = NodeTraversal::next(*n, node)) {
- if (n->isTextNode()) {
- const String& nodeValue = n->nodeValue();
+ for (Node& n : NodeTraversal::descendantsOf(*node)) {
+ if (n.isTextNode()) {
+ const String& nodeValue = n.nodeValue();
result.append(nodeValue);
}
}