OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../js/resources/js-test-pre.js"></script> | 4 <script src="../js/resources/js-test-pre.js"></script> |
5 <script> | 5 <script> |
6 jsTestIsAsync = true; | 6 jsTestIsAsync = true; |
7 | 7 |
8 var numErrors = 0; | 8 var numErrors = 0; |
9 var numErrorsExpected = 3; | 9 var numErrorsExpected = 3; |
10 | 10 |
11 function runTests() | 11 function runTests() |
12 { | 12 { |
13 if (typeof HTMLFormElement.prototype.requestAutocomplete != 'function') { | 13 if (typeof HTMLFormElement.prototype.requestAutocomplete != 'function') { |
14 testFailed('no requestAutocomplete function'); | 14 testFailed('no requestAutocomplete function'); |
15 finishJSTest(); | 15 finishJSTest(); |
16 return; | 16 return; |
17 } | 17 } |
18 | 18 |
19 checkDynamicAttributes(); | 19 checkDynamicAttributes(); |
20 checkNonUserGesture(); | 20 checkNonUserGesture(); |
21 checkParsedAttributes(); | 21 checkParsedAttributes(); |
22 } | 22 } |
23 | 23 |
24 function checkForEnumerableProperties(form) | 24 function checkForEnumerableProperties(form) |
25 { | 25 { |
26 var enumerated = false; | 26 var enumerable = {}; |
27 for (var field in form) { | 27 for (var field in form) |
28 if (/^onautocomplete/i.test(field)) | 28 enumerable[field] = true; |
29 testFailed('enumerable form attribute found on HTMLFormElement: ' +
field); | 29 if (!enumerable.onautocomplete) |
30 enumerated = true; | 30 testFailed('failed to enumerate HTMLFormElement.onautocomplete'); |
31 } | 31 if (!enumerable.onautocompleteerror) |
32 if (enumerated) | 32 testFailed('failed to enumerate HTMLFormElement.onautocompleteerror'); |
33 testPassed('no enumerable properties on HTMLFormElement'); | 33 testPassed('found enumerable properties on HTMLFormElement'); |
34 else | |
35 testFailed('failed to enumerate HTMLFormElement properties'); | |
36 } | 34 } |
37 | 35 |
38 function checkDynamicAttributes() | 36 function checkDynamicAttributes() |
39 { | 37 { |
40 var form = document.createElement('form'); | 38 var form = document.createElement('form'); |
41 checkForEnumerableProperties(form); | 39 checkForEnumerableProperties(form); |
42 | 40 |
43 form.autocomplete = 'off'; | 41 form.autocomplete = 'off'; |
44 form.addEventListener('autocompleteerror', errorWithReason('disabled')); | 42 form.addEventListener('autocompleteerror', errorWithReason('disabled')); |
45 form.requestAutocomplete(); | 43 form.requestAutocomplete(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 </script> | 97 </script> |
100 </head> | 98 </head> |
101 <body> | 99 <body> |
102 <p> <a href="https://code.google.com/p/chromium/issues/detail?id=159537">HTMLFor
mElement#requestAutocomplete and associated events</a> </p> | 100 <p> <a href="https://code.google.com/p/chromium/issues/detail?id=159537">HTMLFor
mElement#requestAutocomplete and associated events</a> </p> |
103 <p> For this test to pass, you should see all PASSED below. </p> | 101 <p> For this test to pass, you should see all PASSED below. </p> |
104 <form autocomplete="off" onautocompleteerror="onError();"></form> | 102 <form autocomplete="off" onautocompleteerror="onError();"></form> |
105 <p id="console"></p> | 103 <p id="console"></p> |
106 <script src="../js/resources/js-test-post.js"></script> | 104 <script src="../js/resources/js-test-post.js"></script> |
107 </body> | 105 </body> |
108 </html> | 106 </html> |
OLD | NEW |