| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-port"> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 |
| 7 test(function() { |
| 8 var url = new URL('http://www.domain.com/'); |
| 9 assert_equals(url.port, ''); |
| 10 |
| 11 url = new URL('http://www.domain.com:8080/'); |
| 12 assert_equals(url.port, '8080'); |
| 13 |
| 14 url.port = 8081; |
| 15 assert_equals(url.port, '8081'); |
| 16 |
| 17 url.port = ''; |
| 18 assert_equals(url.port, '0'); |
| 19 |
| 20 url.port = 80; |
| 21 assert_equals(url.port, ''); |
| 22 |
| 23 url.port = 0; |
| 24 assert_equals(url.port, '0'); |
| 25 }, 'Basic port'); |
| 26 |
| 27 test(function() { |
| 28 var url = new URL('mailto:foo@bar.com'); |
| 29 assert_equals(url.port, ''); |
| 30 |
| 31 url = new URL('file:///home/abarth'); |
| 32 assert_equals(url.port, ''); |
| 33 }, 'no port'); |
| 34 |
| 35 test(function() { |
| 36 var url = new URL('http://abc.de:8080/path/file?query#fragment'); |
| 37 url.href = 'invalid'; |
| 38 assert_equals(url.port, ''); |
| 39 |
| 40 url.port = '8081'; |
| 41 assert_equals(url.port, ''); |
| 42 assert_equals(url.href, 'invalid'); |
| 43 }, 'port property invalid URL'); |
| 44 |
| 45 </script> |
| OLD | NEW |