Why does WHATWG prohibit nested forms in HTML 4 and HTML5?

Why does WHATWG prohibit nested forms in HTML 4 and HTML5?

EDIT : The problem was originally described in How do you overcome the limitation of nesting of an html form?

In short, the author says: You are creating a blog application and you have a form with some fields for creating a new message and a toolbar with “actions” such as “Save” , “Delete” , “Cancel” ... The only problem is that clicking "Delete" will send ALL form fields on the server, although the only thing needed for this action is hidden input with post-id.

So, we are talking about an elegant solution (without JavaScript) for several buttons in a form for sending different sets of input fields (for example, several forms) and for aligning the user interface into a single object ("form") from the user's point of view.

Comment from this discussion : it is almost impossible to completely separate the screen position from the position in the document.

EDIT : I found an interesting note http://anderwald.info/internet/nesting-form-tags-in-xhtml/ - that (X) HTML forbids nested forms like "form> form" but allows "form> fieldset> form ", the W3 validator says it is valid, but browsers have errors with this nesting.

+4
source share
2 answers

As for HTML5 (draft specification), the situation is not as clear as David Dorward suggests. It is true that there is no way that nested forms can be specified in the text / html serialization in the opposite way, without adding a new way to differentiate forms in the markup.

On the other hand, in serializing application / xhtml + xml, it’s not only possible to separate nested forms, but HTML5 goes over several lengths ( http://dev.w3.org/html5/spec/forms.html#form-owner ) to indicate what should happen in this case. In addition, a quick test around the latest versions of FireFox, Opera, Chrome and Safari, as well as viewing the IE9 platform, shows that they all do what HTML5 points to.

That way, it could be valid in the HTML5 content model, but it is not. What determines what is valid and what does not depend heavily on use cases. So far, no one has provided a convincing example of using WHATWG or W3C HTML WG to make nested forms part of valid HTML5.

+2
source

WHATWG does not prohibit nested forms in HTML 4 - they have nothing to do with the language, and they don't have as much in common with HTML 5 as you think.

Nested forms are not allowed because they do not make sense, and if you specify something undefined, it will not be backward compatible with current browsers.

-3
source

Source: https://habr.com/ru/post/1309679/


All Articles