1 description('Test setting the port attribute of the URL in HTMLAnchorElement.');
3 var a = document.createElement('a');
5 debug("Default port as number");
6 a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
8 shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html?key=value'");
10 debug("Default port as string");
11 a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
13 shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html?key=value'");
15 debug("Set port to 0");
16 a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
18 shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
20 // Firefox 3.5.2 does not accept the port if any character is not a digit.
21 debug("Set port to non-number");
22 a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
24 shouldBe("a.href", "'https://www.mydomain.com:4/path/testurl.html?key=value'");
26 // Firefox 3.5.2 does not accept the port if it is null.
27 debug("Set port to null");
28 a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
30 shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
32 // Firefox 3.5.2 does not accept the port if it is null.
33 debug("Set port to empty string");
34 a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
36 shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
38 debug("Set port to undefined");
39 a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
41 shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
43 // Firefox 3.5.2 does not allow setting the port on a URL with protocol foo: .
44 debug("Set port to URL with foo: protocol");
45 a.href = "foo://bar/";
47 shouldBe("a.href", "'foo://bar:50/'");