1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

LibWeb: Add a bare implementation of the URL built-in

This only has the constructor implemented for now.
This commit is contained in:
Idan Horowitz 2021-09-14 00:10:22 +03:00 committed by Andreas Kling
parent 30849b10d5
commit e6abc1b44e
8 changed files with 103 additions and 1 deletions

View file

@ -7,6 +7,7 @@
#include <AK/QuickSort.h>
#include <AK/StringBuilder.h>
#include <AK/Utf8View.h>
#include <LibWeb/URL/URL.h>
#include <LibWeb/URL/URLSearchParams.h>
namespace Web::URL {
@ -97,11 +98,16 @@ void URLSearchParams::append(String const& name, String const& value)
void URLSearchParams::update()
{
// TODO
// 1. If querys URL object is null, then return.
if (m_url.is_null())
return;
// 2. Let serializedQuery be the serialization of querys list.
auto serialized_query = to_string();
// 3. If serializedQuery is the empty string, then set serializedQuery to null.
if (serialized_query.is_empty())
serialized_query = {};
// 4. Set querys URL objects URLs query to serializedQuery.
m_url->set_query({}, move(serialized_query));
}
void URLSearchParams::delete_(String const& name)