You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import {registerHTMLClass} from '../shared/register-html-class.js';
|
|
import {stringAttribute} from '../shared/attributes.js';
|
|
|
|
import {HTMLElement} from './element.js';
|
|
|
|
const tagName = 'a';
|
|
|
|
/**
|
|
* @implements globalThis.HTMLAnchorElement
|
|
*/
|
|
class HTMLAnchorElement extends HTMLElement {
|
|
constructor(ownerDocument, localName = tagName) {
|
|
super(ownerDocument, localName);
|
|
}
|
|
|
|
/* c8 ignore start */ // copy paste from img.src, already covered
|
|
get href() { return encodeURI(decodeURI(stringAttribute.get(this, 'href'))); }
|
|
set href(value) { stringAttribute.set(this, 'href', decodeURI(value)); }
|
|
|
|
get download() { return encodeURI(decodeURI(stringAttribute.get(this, 'download'))); }
|
|
set download(value) { stringAttribute.set(this, 'download', decodeURI(value)); }
|
|
|
|
get target() { return stringAttribute.get(this, 'target'); }
|
|
set target(value) { stringAttribute.set(this, 'target', value); }
|
|
|
|
get type() { return stringAttribute.get(this, 'type'); }
|
|
set type(value) { stringAttribute.set(this, 'type', value); }
|
|
|
|
get rel() { return stringAttribute.get(this, 'rel'); }
|
|
set rel(value) { stringAttribute.set(this, 'rel', value); }
|
|
/* c8 ignore stop */
|
|
|
|
}
|
|
|
|
registerHTMLClass(tagName, HTMLAnchorElement);
|
|
|
|
export {HTMLAnchorElement};
|