diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index ffd0d111cad8..6f4d788fa6b7 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -745,8 +745,6 @@ 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,22 +950,7 @@ impl HTMLFormElement { match element { HTMLElementTypeId::HTMLInputElement => { let input = child.downcast::().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::().unwrap(); diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 298af937a322..7141f9a45371 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -1473,11 +1473,25 @@ impl HTMLInputElement { } // Step 5.12 - vec![FormDatum { + let mut result = vec![FormDatum { ty: ty.clone(), name: name, value: FormDatumValue::String(self.Value()), - }] + }]; + + // 4.10.18.2 + // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitting-element-directionality:-the-dirname-attribute + let dirname: DOMString = self.DirName(); + let directionality = DOMString::from(self.directionality("auto")); + if !dirname.is_empty() { + result.push(FormDatum { + ty: ty.clone(), + name: dirname.clone(), + value: FormDatumValue::String(directionality), + }); + } + + result } // https://html.spec.whatwg.org/multipage/#radio-button-group diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 724a44e9869b..ce290caabf7c 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -2017,7 +2017,6 @@ impl Window { } // TODO: step 11, navigationType. // Step 12, 13 - println!("ScriptThread::navigate"); ScriptThread::navigate(pipeline_id, load_data, replace); }; } diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html b/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html index 6420b5b0c76a..9d1c9eb77e9f 100644 --- a/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html +++ b/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html @@ -20,12 +20,17 @@ } var t = async_test("submit element directionality"); - setTimeout(function() { - document.querySelector("input").value="foobar"; - document.querySelector("button").click(); + document.querySelector("input").value = "foobar"; + document.querySelector("button").click(); - document.querySelector("iframe").onload = t.step_func_done(function() { - assert_equals(getParameterByName("comment.dir"), "ltr"); - }); - }, 3000); + var iframe = document.querySelector("iframe"); + iframe.onload = t.step_func(function() { + // The initial about:blank load event can be fired before the form navigation occurs. + // See https://github.com/whatwg/html/issues/490 for more information. + if(iframe.contentWindow.location.href == "about:blank") { return; } + + assert_equals(getParameterByName("comment.dir"), "ltr"); + + t.done(); + }); diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl.html b/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl.html index 69eb45c992c6..92bf2c3c92b5 100644 --- a/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl.html +++ b/tests/wpt/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-rtl.html @@ -7,8 +7,8 @@
-

-

+

+