UNPKG

@matthewp/linkedom

Version:

A triple-linked lists based DOM implementation

35 lines (24 loc) 1.12 kB
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(stringAttribute.get(this, 'href')); } set href(value) { stringAttribute.set(this, 'href', decodeURI(value)); } get download() { return encodeURI(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); } /* c8 ignore stop */ } registerHTMLClass(tagName, HTMLAnchorElement); export {HTMLAnchorElement};