mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-23 05:04:42 +00:00
enhance Anchor API
This commit is contained in:
@@ -11,3 +11,62 @@
|
||||
testing.expectEqual('http://127.0.0.1:9582/hello/world/anchor2.html', $('#a2').href)
|
||||
testing.expectEqual('https://www.openmymind.net/Elixirs-With-Statement/', $('#a3').href)
|
||||
</script>
|
||||
|
||||
<a id=link href=foo>OK</a>
|
||||
|
||||
<script id=anchor>
|
||||
let link = $('#link');
|
||||
testing.expectEqual('', link.target);
|
||||
link.target = '_blank';
|
||||
testing.expectEqual('_blank', link.target);
|
||||
link.target = '';
|
||||
|
||||
testing.expectEqual('foo', link.href);
|
||||
link.href = 'https://lightpanda.io/';
|
||||
testing.expectEqual('https://lightpanda.io/', link.href);
|
||||
|
||||
testing.expectEqual('https://lightpanda.io', link.origin);
|
||||
|
||||
link.host = 'lightpanda.io:443';
|
||||
testing.expectEqual('lightpanda.io', link.host);
|
||||
testing.expectEqual('', link.port);
|
||||
testing.expectEqual('lightpanda.io', link.hostname);
|
||||
|
||||
link.host = 'lightpanda.io';
|
||||
testing.expectEqual('lightpanda.io', link.host);
|
||||
testing.expectEqual('', link.port);
|
||||
testing.expectEqual('lightpanda.io', link.hostname);
|
||||
|
||||
testing.expectEqual('lightpanda.io', link.host);
|
||||
testing.expectEqual('lightpanda.io', link.hostname);
|
||||
link.hostname = 'foo.bar';
|
||||
testing.expectEqual('https://foo.bar/', link.href);
|
||||
|
||||
testing.expectEqual('', link.search);
|
||||
link.search = 'q=bar';
|
||||
testing.expectEqual('?q=bar', link.search);
|
||||
testing.expectEqual('https://foo.bar/?q=bar', link.href);
|
||||
|
||||
testing.expectEqual('', link.hash);
|
||||
link.hash = 'frag';
|
||||
testing.expectEqual('#frag', link.hash);
|
||||
testing.expectEqual('https://foo.bar/?q=bar#frag', link.href);
|
||||
|
||||
testing.expectEqual('', link.port);
|
||||
link.port = '443';
|
||||
testing.expectEqual('foo.bar', link.host);
|
||||
testing.expectEqual('foo.bar', link.hostname);
|
||||
testing.expectEqual('https://foo.bar/?q=bar#frag', link.href);
|
||||
link.port = null;
|
||||
testing.expectEqual('https://foo.bar/?q=bar#frag', link.href);
|
||||
|
||||
testing.expectEqual('foo', link.href = 'foo');
|
||||
|
||||
testing.expectEqual('', link.type);
|
||||
link.type = 'text/html';
|
||||
testing.expectEqual('text/html', link.type);
|
||||
|
||||
testing.expectEqual('OK', link.text);
|
||||
link.text = 'foo';
|
||||
testing.expectEqual('foo', link.text);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user