Skip to content

Commit f3dab1a

Browse files
committed
Handle innerHTML
1 parent f4d70bf commit f3dab1a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/undom.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,28 @@ export default function undom() {
101101
set: val => { this.setAttribute('style', val); },
102102
get: () => this.getAttribute('style')
103103
});
104+
Object.defineProperty(this, 'innerHTML', {
105+
set: val => {
106+
while (this.firstChild) {
107+
this.removeChild(this.firstChild);
108+
}
109+
this._innerHTML = val;
110+
},
111+
get: () => { return this._innerHTML; }
112+
});
104113
}
105114

106115
get children() {
107116
return this.childNodes.filter(isElement);
108117
}
109118

119+
insertBefore(child, ref) {
120+
super.insertBefore(child, ref);
121+
if (this._innerHTML) {
122+
this._innerHTML = '';
123+
}
124+
}
125+
110126
setAttribute(key, value) {
111127
this.setAttributeNS(null, key, value);
112128
}

0 commit comments

Comments
 (0)