Skip to content

Commit 2a0246a

Browse files
authored
Merge pull request #10 from Group-One-Technology/jr.fix/svg-class
Fix: SVG :class not working
2 parents 7bf50b7 + cdefac6 commit 2a0246a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/entity/attributes.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class Attributes {
1919
this.base = base
2020
this.dynamicAttributes = []
2121
this.childClone = null
22-
this.initialState = { className: this.base.element.className }
22+
this.initialState = { classList: this.base.element.classList }
2323

2424
this._getDynamicAttributes()
2525
}
@@ -35,10 +35,6 @@ export class Attributes {
3535
}
3636
}
3737

38-
get baseClasses() {
39-
return this.initialState.className.split(' ')
40-
}
41-
4238
async evaluate() {
4339
await this.evaluateClass()
4440
await this.evaluateText()
@@ -69,10 +65,12 @@ export class Attributes {
6965
const expr = this.base.element.getAttribute(':class')
7066
if (!expr) return
7167

72-
this.base.element.className = await this.base._interpret(expr, {
73-
base: this.baseClasses,
68+
const updatedClassNames = await this.base._interpret(expr, {
69+
base: this.initialState.classList,
7470
isClass: true,
7571
})
72+
73+
this.base.element.setAttribute('class', updatedClassNames)
7674
}
7775

7876
async evaluateText() {

0 commit comments

Comments
 (0)