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.
17 lines
422 B
JavaScript
17 lines
422 B
JavaScript
'use strict';
|
|
const {HTMLElement} = require('./element.js');
|
|
|
|
const {toString} = HTMLElement.prototype;
|
|
|
|
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}<`);
|
|
}
|
|
}
|
|
exports.TextElement = TextElement
|