| OLD | NEW |
| 1 description('Test setting the search attribute of the URL in HTMLAnchorElement .
'); | 1 description('Test setting the search attribute of the URL in HTMLAnchorElement .
'); |
| 2 | 2 |
| 3 var a = document.createElement('a'); | 3 var a = document.createElement('a'); |
| 4 | 4 |
| 5 debug("Set search without '?'"); | 5 debug("Set search without '?'"); |
| 6 a.href = "https://www.mydomain.com/path/?key=value"; | 6 a.href = "https://www.mydomain.com/path/?key=value"; |
| 7 a.search = "value=key"; | 7 a.search = "value=key"; |
| 8 shouldBe("a.href", "'https://www.mydomain.com/path/?value=key'"); | 8 shouldBe("a.href", "'https://www.mydomain.com/path/?value=key'"); |
| 9 | 9 |
| 10 // IE8 does not encode spaces in search string | 10 // IE8 does not encode spaces in search string |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 shouldBe("a.href", "'https://www.mydomain.com/path/?value%23key#hash'"); | 26 shouldBe("a.href", "'https://www.mydomain.com/path/?value%23key#hash'"); |
| 27 } catch(e) { | 27 } catch(e) { |
| 28 debug("Exception: " + e.description); | 28 debug("Exception: " + e.description); |
| 29 } | 29 } |
| 30 | 30 |
| 31 debug("Set search to a malformed URL"); | 31 debug("Set search to a malformed URL"); |
| 32 a.href = "bad:/|/url"; | 32 a.href = "bad:/|/url"; |
| 33 a.search = "?value=key"; | 33 a.search = "?value=key"; |
| 34 shouldBe("a.href", "'bad:/|/url?value=key'"); | 34 shouldBe("a.href", "'bad:/|/url?value=key'"); |
| 35 | 35 |
| 36 // IE8 converts null to "null", which is not the right thing to do. | |
| 37 debug("Set search to null"); | 36 debug("Set search to null"); |
| 38 a.href = "https://www.mydomain.com/path/?key=value"; | 37 a.href = "https://www.mydomain.com/path/?key=value"; |
| 39 a.search = null; | 38 a.search = null; |
| 40 shouldBe("a.href", "'https://www.mydomain.com/path/'"); | 39 shouldBe("a.href", "'https://www.mydomain.com/path/?null'"); |
| 41 | 40 |
| 42 // Firefox 3.5.2 Removes the '?', and it shouldn't, per | 41 // Firefox 3.5.2 Removes the '?', and it shouldn't, per |
| 43 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib
utes . | 42 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib
utes . |
| 44 debug("Set search to empty string"); | 43 debug("Set search to empty string"); |
| 45 a.href = "https://www.mydomain.com/path/?key=value"; | 44 a.href = "https://www.mydomain.com/path/?key=value"; |
| 46 a.search = ""; | 45 a.search = ""; |
| 47 shouldBe("a.href", "'https://www.mydomain.com/path/?'"); | 46 shouldBe("a.href", "'https://www.mydomain.com/path/?'"); |
| OLD | NEW |