UNPKG

linkedom

Version:

A triple-linked lists based DOM implementation

15 lines (10 loc) 376 B
import {HTMLElement} from './element.js'; const {toString} = HTMLElement.prototype; export class TextElement extends HTMLElement { get innerHTML() { return this.textContent; } set innerHTML(html) { this.textContent = html; } toString() { const outerHTML = toString.call(this.cloneNode()); return outerHTML.replace('><', () => `>${this.textContent}<`); } }