8000 ++ · joshbrew/graphscript@eee4883 · GitHub
[go: up one dir, main page]

Skip to content

Commit eee4883

Browse files
committed
++
1 parent 28c0f32 commit eee4883

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/loaders/html/html.loader.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,16 @@ export const htmlloader = (
6363
let cpy = Object.assign({},node);
6464
let keys = Object.getOwnPropertyNames(cpy);
6565
for(const k of keys) {
66-
if(!(k in cpy)) continue;
6766
if(k === 'style' && typeof node[k] === 'object') {Object.assign(node.__props.style,cpy[k]);}
67+
else if (k === 'className') node.__props.setAttribute('class', cpy[k]);
6868
else node.__props[k] = cpy[k];
6969
}
7070

7171
if(node.__attributes) {
7272
for(const k in node.__attributes) {
7373
if(k === 'style' && typeof node.__attributes[k] === 'object') {Object.assign(node.__props.style,node.__attributes[k]);}
74-
node.__props[k] = node.__attributes[k];
74+
else if (k === 'className') node.__props.setAttribute('class', node.__attributes[k]);
75+
else node.__props[k] = node.__attributes[k];
7576
}
7677
}
7778
node.__proxyObject(node.__props);

src/loaders/html/wc.loader.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const wchtmlloader = (
4848
node.__template += `<style> ${node.__css} </style>`; delete node.__css;
4949
}
5050

51-
if (node.__template) {
51+
if ('__template' in node) {
5252

5353
if(typeof node.__renderonchanged === 'function') {
5454
let renderonchanged = node.__renderonchanged;
@@ -78,15 +78,16 @@ export const wchtmlloader = (
7878
let cpy = Object.assign({},node);
7979
let keys = Object.getOwnPropertyNames(cpy);
8080
for(const k of keys) {
81-
if(!(k in cpy)) continue;
8281
if(k === 'style' && typeof node[k] === 'object') {Object.assign(node.__props.style,cpy[k]);}
82+
else if (k === 'className') node.__props.setAttribute('class', cpy[k]);
8383
else node.__props[k] = cpy[k];
8484
}
8585

8686
if(node.__attributes) {
8787
for(const k in node.__attributes) {
8888
if(k === 'style' && typeof node.__attributes[k] === 'object') {Object.assign(node.__props.style,node.__attributes[k]);}
89-
node.__props[k] = node.__attributes[k];
89+
else if (k === 'className') node.__props.setAttribute('class', node.__attributes[k]);
90+
else node.__props[k] = node.__attributes[k];
9091
}
9192
}
9293
node.__proxyObject(node.__props);
@@ -95,8 +96,8 @@ export const wchtmlloader = (
9596
let cpy = Object.assign({},node);
9697
let keys = Object.getOwnPropertyNames(cpy);
9798
for(const k of keys) {
98-
if(!(k in cpy)) continue;
9999
if(k === 'style' && typeof node[k] === 'object') {Object.assign(node.__props.style,cpy[k]);}
100+
else if (k === 'className') node.__props.setAttribute('class', cpy[k]);
100101
else node.__props[k] = cpy[k];
101102
}
102103

0 commit comments

Comments
 (0)
0