formaction must return document's address when formaction is missing
[WebKit-https.git] / LayoutTests / fast / forms / formaction-attribute-with-empty-value.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/js-test-pre.js"></script>
5 <script>
6
7 description('Test to ensure formAction attribute returns the URL of the document when the attribute is not specified or empty.');
8
9 function runTests() {
10     shouldBe('element.formAction', 'location.href');
11     shouldBe('element.setAttribute("formaction", "http://webkit.org/foo.html"); element.formAction', '"http://webkit.org/foo.html"');
12     shouldBe('element.setAttribute("formaction", ""); element.formAction', 'location.href');
13
14     evalAndLog('base = document.createElement("base"); document.head.appendChild(base); base.href = "https://bugs.webkit.org/";');
15     shouldBe('element.formAction', 'location.href');
16     shouldBe('element.setAttribute("formaction", "foo.html"); element.formAction', '"https://bugs.webkit.org/foo.html"');
17     shouldBe('element.setAttribute("formaction", ""); element.formAction', 'location.href');
18 }
19
20 evalAndLog('element = document.createElement("input");');
21 runTests();
22
23 debug('');
24 evalAndLog('element = document.createElement("button");');
25 runTests();
26
27 </script>
28 </body>
29 </html>