Let the form of the document be the form of Document .
If the form document is not associated with a viewing context or its active sandbox flag has viewing isolated windows, the context flag , then abort these steps without doing anything.
Configure the viewing context as the viewing context of the form document.
If the submit() parameter is not set, and the sender element is invalid , then interactively check the form restrictions and examine the result: if the result is negative (completion of the check completed that there were invalid fields and probably informed the user about this) then it fires a simple event with the name invalid in the form element and then abort these steps.
If submit() not set, then it fires a simple event that bubbles up and is canceled by the name submit in the form. If the default action for the event is prevented (i.e. if the event is canceled), then cancel these steps. Otherwise, continue (effectively, the default action should be to perform the view).
Let the form dataset be the result of building the form dataset for the form in the context of the sender.
Let action be the sender element of action .
If the action is an empty string, let the action address the document document of the form.
Resolve action in relation to the sender element. If this fails, follow these steps.
Let the action be the final absolute URL .
Let action components be the resulting parsed URL .
Let the scheme be a scheme as a result of the parsed URL .
Let enctype be the sender element of enctype .
Let the method be the sender element of method .
Let target be the sender element of target .
If the user specified a specific viewing context that will be used when submitting the form, then let the viewing context context be the viewing context . Otherwise, apply the rules for selecting the viewing context based on the name of the viewing context , using the target as the context of the name and form as the context in which the algorithm is executed, and the context of the viewing context as a result of the viewing context .
If the target viewing context was created in the previous step or, alternatively, if the form document is not yet fully loaded , and the set method flag sent from submit() , then let replace be true. Otherwise, let it be false.
Otherwise, select the appropriate row in the table below based on the schema value specified by the first cell of each row. Then, select the appropriate cell in this row based on the method value as indicated in the first cell of each column. Then go to the steps named in this cell and defined below the table.
| GET | POST ------------------------------------------------------- http | Mutate action URL | Submit as entity body https | Mutate action URL | Submit as entity body ftp | Get action URL | Get action URL javascript | Get action URL | Get action URL data | Get action URL | Post to data: mailto | Mail with headers | Mail as body
If the circuit is not one of those listed in this table, then the behavior of this specification is not defined. User agents must, in the absence of another specification defining this, act in a manner similar to that defined in this specification for similar schemes.