diff options
-rw-r--r-- | lib/src/runtime.ffi.mjs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/src/runtime.ffi.mjs b/lib/src/runtime.ffi.mjs index 7325583..36b6f4a 100644 --- a/lib/src/runtime.ffi.mjs +++ b/lib/src/runtime.ffi.mjs @@ -45,7 +45,12 @@ function createElement(prev, curr, ns, parent = null) { let attr = curr[1]; while (attr.head) { - morphAttr(el, attr.head[0], attr.head[1]); + morphAttr( + el, + attr.head[0], + attr.head[0] === "class" ? `${el.className}{attr.head[1]}` : attr.head[1] + ); + attr = attr.tail; } @@ -86,7 +91,13 @@ function morphElement(prev, curr, ns, parent) { let currAttr = curr[1]; while (currAttr.head) { - currAttrs.set(currAttr.head[0], currAttr.head[1]); + currAttrs.set( + currAttr.head[0], + currAttr.head[0] === "class" + ? `${prev.className} {currAttr.head[1]}` + : currAttr.head[1] + ); + currAttr = currAttr.tail; } |