[ES6] Support subclassing the String builtin object
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / forms / attributes-common-to-form-controls / formaction.html
1 <!DOCTYPE html>
2 <html><head>
3         <title>formaction on button element</title>
4         <meta content="text/html; charset=UTF-8" http-equiv="content-type">
5         <meta content="formaction on button element" name="description">
6     <link href="https://html.spec.whatwg.org/multipage/#dom-fs-formaction" rel="help">
7 </head>
8     <body>
9         <script src="/resources/testharness.js"></script>
10         <script src="/resources/testharnessreport.js"></script>
11
12         <div id="log"></div>
13         <button formaction="http://www.example.com/" style="display: none" type="submit">Submit</button>
14         <input formaction="http://www.example.com/" style="display: none" type="submit" value="submit">
15         <input style="display: none" type="submit" value="submit">
16         <input formaction="" style="display: none" type="submit" value="submit">
17
18         <script type="text/javascript">
19         function relativeToAbsolute(relativeURL) {
20           var a = document.createElement('a');
21           a.href = relativeURL;
22           return a.href;
23         }
24         test(function() {assert_equals(document.getElementsByTagName("button")[0].formAction, "http://www.example.com/")}, "formAction on button support");
25         test(function() {assert_equals(document.getElementsByTagName("input")[0].formAction, "http://www.example.com/")}, "formAction on input support");
26
27         var testElem = document.getElementsByTagName("input")[0];
28         testElem.formAction = "http://www.example.com/page2.html";
29
30         test(function() {assert_equals(document.getElementsByTagName("input")[0].formAction, "http://www.example.com/page2.html")}, "formaction absolute URL value on input reflects correct value after being updated by the DOM");
31         test(function() {assert_equals(document.getElementsByTagName("input")[0].getAttribute("formaction"), "http://www.example.com/page2.html")}, "formAction absolute URL value is correct using getAttribute");
32
33         var testElem = document.getElementsByTagName("input")[0];
34         testElem.formAction = "../page3.html";
35
36         test(function() {assert_equals(document.getElementsByTagName("input")[0].formAction, relativeToAbsolute('../page3.html'))}, "formAction relative URL value on input reflects correct value after being updated by the DOM");
37         test(function() {assert_equals(document.getElementsByTagName("input")[0].getAttribute("formaction"), "../page3.html")}, "formAction relative URL value is correct using getAttribute");
38
39         test(function() {assert_equals(document.getElementsByTagName("input")[1].formAction, document.URL)}, "On getting, when formaction is missing, the document's address must be returned");
40         test(function() {assert_equals(document.getElementsByTagName("input")[2].formAction, document.URL)}, "On getting, when formaction value is the empty string, the document's address must be returned");
41         </script>
42 </body></html>