url.html (2207B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Input url</title> 5 <link rel="author" title="Hyeonseok Shin" href="mailto:hyeonseok@gmail.com"> 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#url-state-%28type=url%29"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 </head> 10 <body> 11 <h1>Input url</h1> 12 <div style="display: none"> 13 <input type="url" id="type_support" /> 14 <input type="url" id="set_value_LF" /> 15 <input type="url" id="set_value_CR" /> 16 <input type="url" id="set_value_CRLF" /> 17 <input type="url" id="value_with_CRLF" value="a
a" /> 18 <input type="url" id="value_with_leading_trailing_white_space" value=" aa " /> 19 <input type="url" id="value_with_leading_trailing_inner_white_space" value=" a a " /> 20 </div> 21 <div id="log"> 22 </div> 23 24 <script type="text/javascript"> 25 test(function(){ 26 var element = document.getElementById('type_support'); 27 assert_equals(element.type, 'url'); 28 }, 'url type supported on input element'); 29 30 test(function(){ 31 var element = document.getElementById('set_value_LF'); 32 element.value = 'a\u000Aa'; 33 assert_equals(element.value, 'aa'); 34 35 element = document.getElementById('set_value_CR'); 36 element.value = 'a\u000Da'; 37 assert_equals(element.value, 'aa'); 38 39 element = document.getElementById('set_value_CRLF'); 40 element.value = 'a\u000D\u000Aa'; 41 assert_equals(element.value, 'aa'); 42 }, 'The value must not be set with "LF" (U+000A) or "CR" (U+000D)'); 43 44 test(function(){ 45 var element = document.getElementById('value_with_CRLF'); 46 assert_equals(element.value, 'aa'); 47 }, 'The value sanitization algorithm is as follows: Strip line breaks from the value'); 48 49 test(function(){ 50 var element = document.getElementById('value_with_leading_trailing_white_space'); 51 assert_equals(element.value, 'aa'); 52 53 element = document.getElementById('value_with_leading_trailing_inner_white_space'); 54 assert_equals(element.value, 'a a'); 55 }, 'The value sanitization algorithm is as follows: Strip leading and trailing whitespace from the value.'); 56 </script> 57 58 </body> 59 </html>