diff options
author | Dmitry Kolupaev <dmitry.klpv@gmail.com> | 2020-01-28 10:34:10 +0300 |
---|---|---|
committer | Dmitry Kolupaev <dmitry.klpv@gmail.com> | 2020-02-25 01:18:20 +0300 |
commit | ef49f2e0eb28f3eb6445eff3aa095edc4b8a64d8 (patch) | |
tree | 530e0ab4dd56c0512639a2cefc32786c47edd7ff /components/script/dom/htmlformelement.rs | |
parent | 6bc4a7df24df6c7ed41f2ee4c2d38a282760c2b6 (diff) | |
download | servo-ef49f2e0eb28f3eb6445eff3aa095edc4b8a64d8.tar.gz servo-ef49f2e0eb28f3eb6445eff3aa095edc4b8a64d8.zip |
Implement dirname for form submit and directionality for element
Diffstat (limited to 'components/script/dom/htmlformelement.rs')
-rw-r--r-- | components/script/dom/htmlformelement.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index adbb790a181..ffd0d111cad 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -745,6 +745,8 @@ impl HTMLFormElement { .map(|field| (&*field.name, field.replace_value(charset))), ); + println!("New URL: {url}", url = &load_data.url); + self.plan_to_navigate(load_data, target); } @@ -952,6 +954,20 @@ impl HTMLFormElement { let input = child.downcast::<HTMLInputElement>().unwrap(); data_set.append(&mut input.form_datums(submitter, encoding)); + + // TODO: probably move to input.form_datums(...) function + // 4.10.18.2 https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitting-element-directionality:-the-dirname-attribute + let dirname: DOMString = input.DirName(); + let dirname_str: &str = &*dirname; + if !dirname_str.is_empty() { + data_set.push(FormDatum { + ty: input.Type(), + name: DOMString::from_string(dirname_str.to_owned()), + value: FormDatumValue::String(DOMString::from( + input.directionality("auto"), + )), + }); + } }, HTMLElementTypeId::HTMLButtonElement => { let button = child.downcast::<HTMLButtonElement>().unwrap(); @@ -983,8 +999,6 @@ impl HTMLFormElement { } } data_set - // TODO: Handle `dirnames` (needs directionality support) - // https://html.spec.whatwg.org/multipage/#the-directionality } /// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set> |