| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script src="script-tests/set-href-attribute-whitespace.js"></script> | 7 <script> |
| 8 description('Test setting the href attribute of an HTMLAnchorElement to a URL wi
th leading and trailing whitespace.'); |
| 9 |
| 10 var a = document.createElement('a'); |
| 11 |
| 12 debug("Set href that starts with a space"); |
| 13 a.href = " https://www.mydomain.com/path/testurl.html?key=value"; |
| 14 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 15 |
| 16 debug("Set href that starts with a newline"); |
| 17 a.href = "\nhttps://www.mydomain.com/path/testurl.html?key=value"; |
| 18 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 19 |
| 20 debug("Set href that starts with a tab"); |
| 21 a.href = "\thttps://www.mydomain.com/path/testurl.html?key=value"; |
| 22 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 23 |
| 24 debug("Set href that starts with a carriage return"); |
| 25 a.href = "\rhttps://www.mydomain.com/path/testurl.html?key=value"; |
| 26 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 27 |
| 28 debug("Set href that starts with a combination of newlines, spaces and tabs"); |
| 29 a.href = "\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value"; |
| 30 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 31 |
| 32 debug("Set href that ends with a space"); |
| 33 a.href = "https://www.mydomain.com/path/testurl.html?key=value "; |
| 34 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 35 |
| 36 debug("Set href that ends with a newline"); |
| 37 a.href = "https://www.mydomain.com/path/testurl.html?key=value\n"; |
| 38 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 39 |
| 40 debug("Set href that ends with a tab"); |
| 41 a.href = "https://www.mydomain.com/path/testurl.html?key=value\t"; |
| 42 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 43 |
| 44 debug("Set href that ends with a carriage return"); |
| 45 a.href = "https://www.mydomain.com/path/testurl.html?key=value\r"; |
| 46 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 47 |
| 48 debug("Set href that ends with a combination of newlines, spaces and tabs"); |
| 49 a.href = "https://www.mydomain.com/path/testurl.html?key=value\n \t\r \n"; |
| 50 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 51 |
| 52 debug("Set href that starts and ends with a combination of newlines, spaces and
tabs"); |
| 53 a.href = "\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value\n \t\r
\n"; |
| 54 shouldBe("a.hostname", "'www.mydomain.com'"); |
| 55 </script> |
| 8 </body> | 56 </body> |
| 9 </html> | 57 </html> |
| OLD | NEW |