Skip to content

Commit 41d58d7

Browse files
committed
backport style.cssText & className patch from preact-worker-demo /cc @KrofDrakula
1 parent 64a6670 commit 41d58d7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/undom.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ export default function undom() {
9292
super(nodeType || 1, nodeName); // ELEMENT_NODE
9393
this.attributes = [];
9494
this.__handlers = {};
95+
this.style = {};
96+
Object.defineProperty(this, 'className', {
97+
set: val => { this.setAttribute('class', val); },
98+
get: () => this.getAttribute('class')
99+
});
100+
Object.defineProperty(this.style, 'cssText', {
101+
set: val => { this.setAttribute('style', val); },
102+
get: () => this.getAttribute('style')
103+
});
95104
}
96105

97106
get children() {

0 commit comments

Comments
 (0)