mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
LibWeb: Add leading "?" to window.location.search if not empty
This commit is contained in:
parent
8a913f336a
commit
6caacfec85
1 changed files with 7 additions and 1 deletions
|
@ -106,7 +106,13 @@ JS::Value LocationObject::hash_getter(JS::Interpreter& interpreter)
|
|||
JS::Value LocationObject::search_getter(JS::Interpreter& interpreter)
|
||||
{
|
||||
auto& window = static_cast<WindowObject&>(interpreter.global_object());
|
||||
return JS::js_string(interpreter, window.impl().document().url().query());
|
||||
auto query = window.impl().document().url().query();
|
||||
if (!query.length())
|
||||
return JS::js_string(interpreter, "");
|
||||
StringBuilder builder;
|
||||
builder.append('?');
|
||||
builder.append(query);
|
||||
return JS::js_string(interpreter, builder.to_string());
|
||||
}
|
||||
|
||||
JS::Value LocationObject::protocol_getter(JS::Interpreter& interpreter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue