mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-29 07:48:47 +00:00
LibWeb: Return current document URL if form action missing or empty
This commit is contained in:
parent
4877e7593c
commit
34825ad3d1
Notes:
sideshowbarker
2024-07-17 18:33:29 +09:00
Author: https://github.com/adamplumb
Commit: 34825ad3d1
Pull-request: https://github.com/SerenityOS/serenity/pull/12642
2 changed files with 14 additions and 1 deletions
|
@ -139,4 +139,17 @@ void HTMLFormElement::remove_associated_element(Badge<FormAssociatedElement>, HT
|
|||
m_associated_elements.remove_first_matching([&](auto& entry) { return entry.ptr() == &element; });
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#dom-fs-action
|
||||
String HTMLFormElement::action() const
|
||||
{
|
||||
auto value = attribute(HTML::AttributeNames::action);
|
||||
|
||||
// Return the current URL if the action attribute is null or an empty string
|
||||
if (value.is_null() || value.is_empty()) {
|
||||
return document().url().to_string();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue