8be62327d13a6f9ce88552468afde3dcec15d5d9
[framework/web/webkit-efl.git] / LayoutTests / fast / dom / HTMLAnchorElement / script-tests / set-href-attribute-whitespace.js
1 description('Test setting the href attribute of an HTMLAnchorElement to a URL with leading and trailing whitespace.');
2
3 var a = document.createElement('a');
4
5 debug("Set href that starts with a space");
6 a.href = " https://www.mydomain.com/path/testurl.html?key=value";
7 shouldBe("a.hostname", "'www.mydomain.com'");
8
9 debug("Set href that starts with a newline");
10 a.href = "\nhttps://www.mydomain.com/path/testurl.html?key=value";
11 shouldBe("a.hostname", "'www.mydomain.com'");
12
13 debug("Set href that starts with a tab");
14 a.href = "\thttps://www.mydomain.com/path/testurl.html?key=value";
15 shouldBe("a.hostname", "'www.mydomain.com'");
16
17 debug("Set href that starts with a carriage return");
18 a.href = "\rhttps://www.mydomain.com/path/testurl.html?key=value";
19 shouldBe("a.hostname", "'www.mydomain.com'");
20
21 debug("Set href that starts with a combination of newlines, spaces and tabs");
22 a.href = "\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value";
23 shouldBe("a.hostname", "'www.mydomain.com'");
24
25 debug("Set href that ends with a space");
26 a.href = "https://www.mydomain.com/path/testurl.html?key=value ";
27 shouldBe("a.hostname", "'www.mydomain.com'");
28
29 debug("Set href that ends with a newline");
30 a.href = "https://www.mydomain.com/path/testurl.html?key=value\n";
31 shouldBe("a.hostname", "'www.mydomain.com'");
32
33 debug("Set href that ends with a tab");
34 a.href = "https://www.mydomain.com/path/testurl.html?key=value\t";
35 shouldBe("a.hostname", "'www.mydomain.com'");
36
37 debug("Set href that ends with a carriage return");
38 a.href = "https://www.mydomain.com/path/testurl.html?key=value\r";
39 shouldBe("a.hostname", "'www.mydomain.com'");
40
41 debug("Set href that ends with a combination of newlines, spaces and tabs");
42 a.href = "https://www.mydomain.com/path/testurl.html?key=value\n \t\r \n";
43 shouldBe("a.hostname", "'www.mydomain.com'");
44
45 debug("Set href that starts and ends with a combination of newlines, spaces and tabs");
46 a.href = "\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value\n \t\r \n";
47 shouldBe("a.hostname", "'www.mydomain.com'");
48
49 var successfullyParsed = true;