Commit ea52a3bd authored by tkent@chromium.org's avatar tkent@chromium.org

Fix formAction return value for empty formaction content attribute.

According to the standard and web-platform-tests, empty attribute value should
return the document URL.
https://html.spec.whatwg.org/multipage/forms.html#dom-fs-formaction

> The formAction IDL attribute must reflect the formaction content attribute,
> except that on getting, when the content attribute is missing or its value is
> the empty string, the document's address must be returned instead.

This CL removes empty formaction tests in submit-form-attributes.html.
html/semantics/forms/attributes-common-to-form-controls/formaction*.html cover
them.

BUG=520835

Review URL: https://codereview.chromium.org/1321033003

git-svn-id: svn://svn.chromium.org/blink/trunk@201617 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent d4712291
...@@ -396,8 +396,6 @@ crbug.com/508725 imported/web-platform-tests/html/semantics/forms/textfieldselec ...@@ -396,8 +396,6 @@ crbug.com/508725 imported/web-platform-tests/html/semantics/forms/textfieldselec
crbug.com/490511 imported/web-platform-tests/html/semantics/text-level-semantics/the-wbr-element/wbr-element.html [ ImageOnlyFailure ] crbug.com/490511 imported/web-platform-tests/html/semantics/text-level-semantics/the-wbr-element/wbr-element.html [ ImageOnlyFailure ]
crbug.com/490511 imported/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src.html [ Failure ] crbug.com/490511 imported/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src.html [ Failure ]
crbug.com/526920 imported/web-platform-tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html [ Failure ] crbug.com/526920 imported/web-platform-tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html [ Failure ]
crbug.com/520835 imported/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/formAction_document_address.html [ Failure ]
crbug.com/520835 imported/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/formaction.html [ Failure ]
# script-for-event.html: We can't check in failure results because we also have # script-for-event.html: We can't check in failure results because we also have
# script-for-event.xhtml. # script-for-event.xhtml.
crbug.com/520844 imported/web-platform-tests/html/semantics/scripting-1/the-script-element/script-for-event.html [ Failure ] crbug.com/520844 imported/web-platform-tests/html/semantics/scripting-1/the-script-element/script-for-event.html [ Failure ]
......
...@@ -4,7 +4,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -4,7 +4,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Ordinary values for input: Ordinary values for input:
PASS input.formAction is ""
PASS input.formEnctype is "" PASS input.formEnctype is ""
PASS input.formMethod is "" PASS input.formMethod is ""
PASS input.formTarget is "" PASS input.formTarget is ""
...@@ -59,7 +58,6 @@ PASS input.getAttribute("formTarget") is "256" ...@@ -59,7 +58,6 @@ PASS input.getAttribute("formTarget") is "256"
PASS input.formTarget is "256" PASS input.formTarget is "256"
Ordinary values for button: Ordinary values for button:
PASS button.formAction is ""
PASS button.formEnctype is "" PASS button.formEnctype is ""
PASS button.formMethod is "" PASS button.formMethod is ""
PASS button.formTarget is "" PASS button.formTarget is ""
......
...@@ -13,7 +13,6 @@ var input = document.createElement('input'); ...@@ -13,7 +13,6 @@ var input = document.createElement('input');
debug('Ordinary values for input:'); debug('Ordinary values for input:');
input.type = "submit"; input.type = "submit";
shouldBeEqualToString('input.formAction', '');
shouldBeEqualToString('input.formEnctype', ''); shouldBeEqualToString('input.formEnctype', '');
shouldBeEqualToString('input.formMethod', ''); shouldBeEqualToString('input.formMethod', '');
shouldBeEqualToString('input.formTarget', ''); shouldBeEqualToString('input.formTarget', '');
...@@ -110,7 +109,6 @@ var button = document.createElement('button'); ...@@ -110,7 +109,6 @@ var button = document.createElement('button');
debug(''); debug('');
debug('Ordinary values for button:'); debug('Ordinary values for button:');
button.type = "submit"; button.type = "submit";
shouldBeEqualToString('button.formAction', '');
shouldBeEqualToString('button.formEnctype', ''); shouldBeEqualToString('button.formEnctype', '');
shouldBeEqualToString('button.formMethod', ''); shouldBeEqualToString('button.formMethod', '');
shouldBeEqualToString('button.formTarget', ''); shouldBeEqualToString('button.formTarget', '');
......
...@@ -24,7 +24,7 @@ interface HTMLButtonElement : HTMLElement { ...@@ -24,7 +24,7 @@ interface HTMLButtonElement : HTMLElement {
[Reflect] attribute boolean autofocus; [Reflect] attribute boolean autofocus;
[Reflect] attribute boolean disabled; [Reflect] attribute boolean disabled;
[ImplementedAs=formOwner] readonly attribute HTMLFormElement? form; [ImplementedAs=formOwner] readonly attribute HTMLFormElement? form;
[Reflect, URL] attribute DOMString formAction; attribute DOMString formAction;
attribute DOMString formEnctype; attribute DOMString formEnctype;
attribute DOMString formMethod; attribute DOMString formMethod;
[Reflect] attribute boolean formNoValidate; [Reflect] attribute boolean formNoValidate;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "core/html/HTMLInputElement.h" #include "core/html/HTMLInputElement.h"
#include "core/html/HTMLLegendElement.h" #include "core/html/HTMLLegendElement.h"
#include "core/html/ValidityState.h" #include "core/html/ValidityState.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/inspector/ConsoleMessage.h" #include "core/inspector/ConsoleMessage.h"
#include "core/layout/LayoutBox.h" #include "core/layout/LayoutBox.h"
#include "core/layout/LayoutTheme.h" #include "core/layout/LayoutTheme.h"
...@@ -85,6 +86,19 @@ DEFINE_TRACE(HTMLFormControlElement) ...@@ -85,6 +86,19 @@ DEFINE_TRACE(HTMLFormControlElement)
LabelableElement::trace(visitor); LabelableElement::trace(visitor);
} }
String HTMLFormControlElement::formAction() const
{
const AtomicString& action = fastGetAttribute(formactionAttr);
if (action.isEmpty())
return document().url();
return document().completeURL(stripLeadingAndTrailingHTMLSpaces(action));
}
void HTMLFormControlElement::setFormAction(const AtomicString& value)
{
setAttribute(formactionAttr, value);
}
String HTMLFormControlElement::formEnctype() const String HTMLFormControlElement::formEnctype() const
{ {
const AtomicString& formEnctypeAttr = fastGetAttribute(formenctypeAttr); const AtomicString& formEnctypeAttr = fastGetAttribute(formenctypeAttr);
......
...@@ -46,6 +46,8 @@ public: ...@@ -46,6 +46,8 @@ public:
~HTMLFormControlElement() override; ~HTMLFormControlElement() override;
DECLARE_VIRTUAL_TRACE(); DECLARE_VIRTUAL_TRACE();
String formAction() const;
void setFormAction(const AtomicString&);
String formEnctype() const; String formEnctype() const;
void setFormEnctype(const AtomicString&); void setFormEnctype(const AtomicString&);
String formMethod() const; String formMethod() const;
......
...@@ -36,7 +36,7 @@ interface HTMLInputElement : HTMLElement { ...@@ -36,7 +36,7 @@ interface HTMLInputElement : HTMLElement {
// The 'files' attribute is intentionally not readonly. // The 'files' attribute is intentionally not readonly.
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=22682 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22682
attribute FileList? files; attribute FileList? files;
[Reflect, URL] attribute DOMString formAction; attribute DOMString formAction;
[CustomElementCallbacks] attribute DOMString formEnctype; [CustomElementCallbacks] attribute DOMString formEnctype;
[CustomElementCallbacks] attribute DOMString formMethod; [CustomElementCallbacks] attribute DOMString formMethod;
[Reflect] attribute boolean formNoValidate; [Reflect] attribute boolean formNoValidate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment