mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-06 11:12:54 +00:00
LibWeb: Resolve HTMLFormElement.action
relative to document base URL
Rather than returning a relative URL, an absolutized URL is now returned relative to the document base URL
This commit is contained in:
parent
33c62be7f9
commit
48e5d28ec9
Notes:
github-actions[bot]
2024-09-08 07:48:40 +00:00
Author: https://github.com/tcl3
Commit: 48e5d28ec9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1321
3 changed files with 21 additions and 4 deletions
|
@ -604,12 +604,12 @@ String HTMLFormElement::action() const
|
|||
// The action IDL attribute must reflect the content attribute of the same name, except that on getting, when the
|
||||
// content attribute is missing or its value is the empty string, the element's node document's URL must be returned
|
||||
// instead.
|
||||
if (auto maybe_action = attribute(AttributeNames::action);
|
||||
maybe_action.has_value() && !maybe_action.value().is_empty()) {
|
||||
return maybe_action.value();
|
||||
auto form_action_attribute = attribute(AttributeNames::action);
|
||||
if (!form_action_attribute.has_value() || form_action_attribute.value().is_empty()) {
|
||||
return document().url_string();
|
||||
}
|
||||
|
||||
return MUST(document().url().to_string());
|
||||
return MUST(document().base_url().complete_url(form_action_attribute.value()).to_string());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-fs-action
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue