mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 16:21:29 +00:00
LibWebView: Prevent quoting attribute values twice in the Inspector
As of commit ccd701809f
, the formatter for
JsonValue now fully serializes the value. The serializer will surround
the string value with quotes. We want control over when we add quotes to
the generated Inspector HTML, so avoid formatting attributes as raw JSON
values.
This commit is contained in:
parent
982799f7a0
commit
2fd034d1df
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/2fd034d1df Pull-request: https://github.com/SerenityOS/serenity/pull/22928 Reviewed-by: https://github.com/DanShaders
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
* Copyright (c) 2023-2024, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -523,11 +523,13 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree)
|
|||
|
||||
if (auto attributes = node.get_object("attributes"sv); attributes.has_value()) {
|
||||
attributes->for_each_member([&](auto const& name, auto const& value) {
|
||||
auto value_string = value.as_string();
|
||||
|
||||
builder.append(" "sv);
|
||||
builder.appendff("<span data-node-type=\"attribute\" data-tag=\"{}\" data-attribute-name=\"{}\" data-attribute-value=\"{}\" class=\"editable\">", tag, name, value);
|
||||
builder.appendff("<span data-node-type=\"attribute\" data-tag=\"{}\" data-attribute-name=\"{}\" data-attribute-value=\"{}\" class=\"editable\">", tag, name, value_string);
|
||||
builder.appendff("<span class=\"attribute-name\">{}</span>", name);
|
||||
builder.append('=');
|
||||
builder.appendff("<span class=\"attribute-value\">\"{}\"</span>", value);
|
||||
builder.appendff("<span class=\"attribute-value\">\"{}\"</span>", value_string);
|
||||
builder.append("</span>"sv);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue