Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
html/semantics/forms/attributes-common-to-form-controls/formaction.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html><head> | ||
<title>formaction on button element</title> | ||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | ||
<meta content="formaction on button element" name="description"> | ||
<link href="http://www.w3.org/TR/html5/attributes-common-to-form-controls.html#dom-fs-formaction" rel="help"> | ||
</head> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id="log"></div> | ||
<button formaction="http://www.example.com/" style="display: none" type="submit">Submit</button> | ||
<input formaction="http://www.example.com/" style="display: none" type="submit" value="submit"> | ||
<input style="display: none" type="submit" value="submit"> | ||
|
||
<script type="text/javascript"> | ||
test(function() {assert_equals(document.getElementsByTagName("button")[0].formAction, "http://www.example.com/")}, "formAction on button support"); | ||
test(function() {assert_equals(document.getElementsByTagName("input")[0].formAction, "http://www.example.com/")}, "formAction on input support"); | ||
|
||
var testElem = document.getElementsByTagName("input")[0]; | ||
testElem.formAction = "http://www.example.com/page2.html"; | ||
|
||
test(function() {assert_equals(document.getElementsByTagName("input")[0].formAction, "http://www.example.com/page2.html")}, "formAction on input reflects correct value after being updated by the DOM"); | ||
test(function() {assert_equals(document.getElementsByTagName("input")[0].getAttribute("formaction"), "http://www.example.com/page2.html")}, "formAction value is correct using getAttribute"); | ||
|
||
test(function() {assert_equals(document.getElementsByTagName("input")[1].formAction, "")}, "formAction no specified on input returns an empty string"); | ||
</script> | ||
</body></html> |