mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:27:45 +00:00
LibJS: Include the class name of objects in MarkupGenerator output
Add a little label before the "{ }" so you can see what kind of object it is. This makes Browser's JS console significantly nicer to use. :^)
This commit is contained in:
parent
df84cd77b8
commit
4d35ffdf3c
2 changed files with 5 additions and 1 deletions
|
@ -83,6 +83,7 @@ void MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, Has
|
||||||
|
|
||||||
if (value.is_object()) {
|
if (value.is_object()) {
|
||||||
auto& object = value.as_object();
|
auto& object = value.as_object();
|
||||||
|
output_html.append(wrap_string_in_style(object.class_name(), StyleType::ObjectType));
|
||||||
if (object.is_function())
|
if (object.is_function())
|
||||||
return function_to_html(object, output_html, seen_objects);
|
return function_to_html(object, output_html, seen_objects);
|
||||||
if (is<Date>(object))
|
if (is<Date>(object))
|
||||||
|
@ -198,6 +199,8 @@ String MarkupGenerator::style_from_style_type(StyleType type)
|
||||||
return "color: -libweb-palette-syntax-control-keyword;";
|
return "color: -libweb-palette-syntax-control-keyword;";
|
||||||
case StyleType::Identifier:
|
case StyleType::Identifier:
|
||||||
return "color: -libweb-palette-syntax-identifier;";
|
return "color: -libweb-palette-syntax-identifier;";
|
||||||
|
case StyleType::ObjectType:
|
||||||
|
return "padding: 2px; background-color: #ddf; color: black; font-weight: bold;";
|
||||||
default:
|
default:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ private:
|
||||||
Operator,
|
Operator,
|
||||||
Keyword,
|
Keyword,
|
||||||
ControlKeyword,
|
ControlKeyword,
|
||||||
Identifier
|
Identifier,
|
||||||
|
ObjectType,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void value_to_html(Value, StringBuilder& output_html, HashTable<Object*> seen_objects = {});
|
static void value_to_html(Value, StringBuilder& output_html, HashTable<Object*> seen_objects = {});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue