| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <title>The selection interface members</title> | 2 <title>The selection interface members</title> |
| 3 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> | 3 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> |
| 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#textFieldSelectio
n"> | 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#textFieldSelectio
n"> |
| 5 <script src="../../../../../../resources/testharness.js"></script> | 5 <script src="../../../../../../resources/testharness.js"></script> |
| 6 <script src="../../../../../../resources/testharnessreport.js"></script> | 6 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 7 <div id="log"></div> | 7 <div id="log"></div> |
| 8 <script> | 8 <script> |
| 9 test(function() { | 9 test(function() { |
| 10 var valid = ["text", "search", "url", "tel", "email", "password"]; | 10 var valid = ["text", "search", "url", "tel", "password"]; |
| 11 var invalid = ["hidden", "datetime", "date", "month", "week", "datetime-local"
, | 11 var invalid = ["hidden", "datetime", "date", "month", "week", "datetime-local"
, |
| 12 "number", "range", "color", "checkbox", "radio", "button", | 12 "number", "range", "color", "checkbox", "radio", "button", |
| 13 "file", "submit", "image", "reset"]; | 13 "file", "email", "submit", "image", "reset"]; |
| 14 valid.forEach(function(aType) { | 14 valid.forEach(function(aType) { |
| 15 test(function() { | 15 test(function() { |
| 16 var input = document.createElement("input"); | 16 var input = document.createElement("input"); |
| 17 input.type = aType; | 17 input.type = aType; |
| 18 assert_equals(input.type, aType, "Input type unsupported") | 18 assert_equals(input.type, aType, "Input type unsupported") |
| 19 input.select(); | 19 input.select(); |
| 20 var a = input.selectionStart; | 20 var a = input.selectionStart; |
| 21 input.selectionStart = 0; | 21 input.selectionStart = 0; |
| 22 a = input.selectionEnd; | 22 a = input.selectionEnd; |
| 23 input.selectionEnd = 0; | 23 input.selectionEnd = 0; |
| 24 input.setSelectionRange(0, 0); | 24 input.setSelectionRange(0, 0); |
| 25 }, "Selection attributes should apply to type " + aType) | 25 }, "Selection attributes should apply to type " + aType) |
| 26 }) | 26 }) |
| 27 | 27 |
| 28 invalid.forEach(function(aType) { | 28 invalid.forEach(function(aType) { |
| 29 test(function() { | 29 test(function() { |
| 30 var input = document.createElement("input"); | 30 var input = document.createElement("input"); |
| 31 input.type = aType; | 31 input.type = aType; |
| 32 assert_equals(input.type, aType, "Input type unsupported") | 32 assert_equals(input.type, aType, "Input type unsupported") |
| 33 assert_throws("INVALID_STATE_ERR", function() { input.select(); }, "Should
throw with type " + aType); | 33 assert_throws("INVALID_STATE_ERR", function() { input.select(); }, "Should
throw with type " + aType); |
| 34 assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionSta
rt; }); | 34 assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionSta
rt; }); |
| 35 assert_throws("INVALID_STATE_ERR", function() { input.selectionStart = 0;
}); | 35 assert_throws("INVALID_STATE_ERR", function() { input.selectionStart = 0;
}); |
| 36 assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionEnd
; }); | 36 assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionEnd
; }); |
| 37 assert_throws("INVALID_STATE_ERR", function() { input.selectionEnd = 0; })
; | 37 assert_throws("INVALID_STATE_ERR", function() { input.selectionEnd = 0; })
; |
| 38 assert_throws("INVALID_STATE_ERR", function() { input.setSelectionRange(0,
0); }); | 38 assert_throws("INVALID_STATE_ERR", function() { input.setSelectionRange(0,
0); }); |
| 39 }, "Selection attributes should not apply to type " + aType) | 39 }, "Selection attributes should not apply to type " + aType) |
| 40 }) | 40 }) |
| 41 }); | 41 }); |
| 42 </script> | 42 </script> |
| OLD | NEW |