Closed Bug 1392253 Opened 7 years ago Closed 7 years ago

form.action needs to return current document URL when content attribute is the empty string

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: ayg, Assigned: ayg)

Details

https://jsfiddle.net/24p68s0t/

In Chrome, WebKit, and Edge, this outputs ",https://fiddle.jshell.net/24p68s0t/show/", which says that when you get the IDL .action property on <form action=""> it returns the page's current URL (which is where the form is actually going to submit, after all).  This matches the spec:

"""
The action IDL attribute must reflect the content attribute of the same name, except that on getting, when the content attribute is missing or its value is the empty string, the element's node document's URL must be returned instead.
"""
https://html.spec.whatwg.org/#dom-fs-action

(The spec also currently mandates this behavior even when the content attribute is missing, but this does not match browsers, and I'm going to submit a spec fix.)
Fiddle including formAction as well:

https://jsfiddle.net/24p68s0t/1/

This shows that for formAction, Chrome and WebKit match the spec and also output the document URL for a missing attribute, unlike with action.  Edge always just outputs an empty string, but we should align with Chrome/WebKit/spec.
Whoops, I was testing on an old Firefox.  This was mostly fixed by bug 1366361 part 1, but that seems to match the previous spec, not other browsers.

Spec PR to match browsers: https://github.com/whatwg/html/pull/2950
Upstream test submission: https://github.com/w3c/web-platform-tests/pull/6959

Once one UA already matches the spec -- which makes more sense than what other UAs do anyway -- I'm not sure if we want to change the spec on this point.  Maybe the other engines should change.
Per the discussion on the PR, it seems we want the spec to stay as it is.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.