| <html> | |
| <head> | |
| <script> | |
| function dispatchActivateEvent(target) { | |
| // Create a DOMActivate event and dispatch it | |
| var event = document.createEvent('UIEvents'); | |
| event.initUIEvent('DOMActivate', true, true, window, 1) | |
| target.dispatchEvent(event); | |
| } | |
| function runTest() { | |
| if (window.testRunner) | |
| testRunner.dumpAsText(); | |
| var button = document.getElementById('button'); | |
| var input = document.getElementById('input'); | |
| onsubmitCalled = false; | |
| dispatchActivateEvent(button); | |
| dispatchActivateEvent(input); | |
| if (!onsubmitCalled) | |
| document.getElementById('result').innerHTML = 'SUCCESS' | |
| } | |
| </script> | |
| </head> | |
| <body onload="runTest()"> | |
| <form onsubmit="onsubmitCalled = true; return false"> | |
| <button id="button" disabled>Disabled button</button> | |
| <input id="input" type="submit" disabled> | |
| </form> | |
| This tests that disabled form elements don't call submit when they receive a DOMActivate event. If this test is successful, the text "SUCCESS" should be shown below. | |
| <div id="result">FAILURE</div> | |
| </body> | |
| </html> |