mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb/DOM: Only list pseudo-elements that actually exist
This stops `::before` and `::after` nodes showing up for every single element in the inspector tree. Unfortunately there's no way for us to detect that one of these doesn't exist in layout but has *some* style specified for it, but that seems like a rare use case.
This commit is contained in:
parent
140a099fe6
commit
4df472988c
Notes:
github-actions[bot]
2025-07-03 08:58:07 +00:00
Author: https://github.com/AtkinsSJ
Commit: 4df472988c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5274
1 changed files with 6 additions and 3 deletions
|
@ -1589,12 +1589,15 @@ void Element::serialize_pseudo_elements_as_json(JsonArraySerializer<StringBuilde
|
||||||
{
|
{
|
||||||
if (!m_pseudo_element_data)
|
if (!m_pseudo_element_data)
|
||||||
return;
|
return;
|
||||||
for (auto& pseudo_element : m_pseudo_element_data->keys()) {
|
for (auto const& [pseudo_element_type, pseudo_element] : (*m_pseudo_element_data)) {
|
||||||
|
// FIXME: Find a way to make these still inspectable? (eg, `::before { display: none }`)
|
||||||
|
if (!pseudo_element->layout_node())
|
||||||
|
continue;
|
||||||
auto object = MUST(children_array.add_object());
|
auto object = MUST(children_array.add_object());
|
||||||
MUST(object.add("name"sv, MUST(String::formatted("::{}", CSS::pseudo_element_name(pseudo_element)))));
|
MUST(object.add("name"sv, MUST(String::formatted("::{}", CSS::pseudo_element_name(pseudo_element_type)))));
|
||||||
MUST(object.add("type"sv, "pseudo-element"));
|
MUST(object.add("type"sv, "pseudo-element"));
|
||||||
MUST(object.add("parent-id"sv, unique_id().value()));
|
MUST(object.add("parent-id"sv, unique_id().value()));
|
||||||
MUST(object.add("pseudo-element"sv, to_underlying(pseudo_element)));
|
MUST(object.add("pseudo-element"sv, to_underlying(pseudo_element_type)));
|
||||||
MUST(object.finish());
|
MUST(object.finish());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue