mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Bring 'construct_entry_list' closer to specs
This commit is contained in:
parent
4e8376d07e
commit
6e77fff698
Notes:
github-actions[bot]
2024-07-25 04:43:32 +00:00
Author: https://github.com/mobounya 🔰 Commit: https://github.com/LadybirdBrowser/ladybird/commit/6e77fff698e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/822
1 changed files with 11 additions and 4 deletions
|
@ -186,10 +186,17 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
|
|||
entry_list.append(XHR::FormDataEntry { .name = name.to_string(), .value = control_as_form_associated_element->value() });
|
||||
}
|
||||
|
||||
// FIXME: 11. If the element has a dirname attribute, and that attribute's value is not the empty string, then:
|
||||
// FIXME: 1. Let dirname be the value of the element's dirname attribute.
|
||||
// FIXME: 2. Let dir be the string "ltr" if the directionality of the element is 'ltr', and "rtl" otherwise (i.e., when the directionality of the element is 'rtl').
|
||||
// FIXME: 3. Create an entry with dirname and dir, and append it to entry list.
|
||||
// 11. If the element has a dirname attribute, and that attribute's value is not the empty string, then:
|
||||
if (auto attribute = control->get_attribute(HTML::AttributeNames::dirname); attribute.has_value() && !attribute.value().is_empty()) {
|
||||
// 1. Let dirname be the value of the element's dirname attribute.
|
||||
String dirname = attribute.value();
|
||||
|
||||
// 2. Let dir be the string "ltr" if the directionality of the element is 'ltr', and "rtl" otherwise (i.e., when the directionality of the element is 'rtl').
|
||||
String dir = MUST((control->directionality() == DOM::Element::Directionality::Ltr) ? String::from_utf8("ltr"sv) : String::from_utf8("rtr"sv));
|
||||
|
||||
// 3. Create an entry with dirname and dir, and append it to entry list.
|
||||
entry_list.append(XHR::FormDataEntry { .name = dirname, .value = dir });
|
||||
}
|
||||
}
|
||||
// 6. Let form data be a new FormData object associated with entry list.
|
||||
auto form_data = TRY(XHR::FormData::construct_impl(realm, entry_list));
|
||||
|
|
Loading…
Reference in a new issue