srctree

Robin Linden parent 4d0d75f0 6d945d7c
html: Stop dropping all whitespace-only text nodes

This fixes cases like <span>hello</span> <span>world</span> beingrendered without any space between the words.

inlinesplit
html/BUILD added: 3, removed: 6, total 0
@@ -13,7 +13,6 @@ cc_library(
deps = [
"//dom",
"//html2",
"//util:string",
"@spdlog",
],
)
 
html/parser.cpp added: 3, removed: 6, total 0
@@ -8,7 +8,6 @@
#include "html2/parser_states.h"
#include "html2/token.h"
#include "html2/tokenizer.h"
#include "util/string.h"
 
#include <spdlog/spdlog.h>
 
@@ -246,8 +245,7 @@ void Parser::operator()(html2::EndOfFileToken const &) {
void Parser::generate_text_node_if_needed() {
assert(!open_elements_.empty());
auto text = std::exchange(current_text_, {}).str();
bool is_uninteresting = std::ranges::all_of(text, [](char c) { return util::is_whitespace(c); });
if (is_uninteresting) {
if (text.empty()) {
return;
}