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.

15 lines
376 B
JavaScript

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}<`);
}
}