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