blob: f5056af6e89058f698b96c14b98895ddb91fe023 [file] [log] [blame]
<!DOCTYPE HTML>
<link rel="help" href="http://url.spec.whatwg.org/#dom-url-href">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
var url = new URL('http://www.domain.com/');
assert_equals(url.href, 'http://www.domain.com/');
assert_equals(url.href, url.toString());
url.href = 'mailto:foo@bar.com';
assert_equals(url.href, 'mailto:foo@bar.com');
}, 'href property');
test(function() {
var url = new URL('http://abc.de/path/file?query#fragment');
url.href = 'invalid';
assert_equals(url.href, 'invalid');
}, 'setting href to an invalid URL');
test(function() {
var url = new URL('http://domain.com/');
url.href = null;
assert_equals(url.href, 'null');
}, 'setting href to null');
</script>