diff options
Diffstat (limited to 'Libraries/LibWeb/DOM/HTMLFormElement.cpp')
-rw-r--r-- | Libraries/LibWeb/DOM/HTMLFormElement.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/Libraries/LibWeb/DOM/HTMLFormElement.cpp b/Libraries/LibWeb/DOM/HTMLFormElement.cpp index 8e310983f1..cabb282d3e 100644 --- a/Libraries/LibWeb/DOM/HTMLFormElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLFormElement.cpp @@ -29,6 +29,7 @@ #include <LibWeb/DOM/HTMLInputElement.h> #include <LibWeb/Frame.h> #include <LibWeb/HtmlView.h> +#include <LibWeb/URLEncoder.h> namespace Web { @@ -59,12 +60,7 @@ void HTMLFormElement::submit(RefPtr<HTMLInputElement> submitter) URL url(document().complete_url(action())); - struct NameAndValue { - String name; - String value; - }; - - Vector<NameAndValue> parameters; + Vector<URLQueryParam> parameters; for_each_in_subtree_of_type<HTMLInputElement>([&](auto& node) { auto& input = to<HTMLInputElement>(node); @@ -73,15 +69,7 @@ void HTMLFormElement::submit(RefPtr<HTMLInputElement> submitter) return IterationDecision::Continue; }); - StringBuilder builder; - for (size_t i = 0; i < parameters.size(); ++i) { - builder.append(parameters[i].name); - builder.append('='); - builder.append(parameters[i].value); - if (i != parameters.size() - 1) - builder.append('&'); - } - url.set_query(builder.to_string()); + url.set_query(url_encode(parameters)); // FIXME: We shouldn't let the form just do this willy-nilly. document().frame()->html_view()->load(url); |