Truly independent web browser
LibWeb: Collect only nodes with post-connection steps after insertion
Andreas Klingb8b7b1934414
diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cppindex bff6e1a1343..bb03ee03660 100644--- a/Libraries/LibWeb/DOM/Node.cpp+++ b/Libraries/LibWeb/DOM/Node.cpp@@ -1029,8 +1029,11 @@ static void run_post_connection_steps(Nodes const& nodes)for (auto& node : nodes) {// 1. For each shadow-including inclusive descendant inclusiveDescendant of node, in shadow-including tree// order: append inclusiveDescendant to staticNodeList.+ // OPTIMIZATION: The post-connection steps of a node whose class has none do nothing, so only nodes with some+ // are collected.node->for_each_shadow_including_inclusive_descendant([&static_node_list](Node& inclusive_descendant) {- static_node_list.append(inclusive_descendant);+ if (inclusive_descendant.has_post_connection_steps())+ static_node_list.append(inclusive_descendant);return TraversalDecision::Continue;});}