1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibWeb: Simplify Node::text_content()

This commit is contained in:
Nico Weber 2020-08-17 21:19:10 -04:00 committed by Andreas Kling
parent 68189f80cc
commit 2f85af2a20

View file

@ -78,13 +78,9 @@ const HTML::HTMLElement* Node::enclosing_html_element() const
String Node::text_content() const
{
Vector<String> strings;
StringBuilder builder;
for (auto* child = first_child(); child; child = child->next_sibling()) {
auto text = child->text_content();
if (!text.is_empty()) {
builder.append(child->text_content());
}
builder.append(child->text_content());
}
return builder.to_string();
}