Fix SVG classes example in readme

This snippet was added in #287, but it clearly was never tested because it doesn't work (the `underline` class is simply overwritten).
pull/393/head
Jan Schär 7 years ago committed by GitHub
parent 4455e73e9f
commit 00129c25ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -525,12 +525,10 @@ You can add dynamic classes to SVG elements for these cases by using the _attrib
```js
h('svg', [
h('text.underline', { // 'underline' is a selector class, remain unchanged between renders.
h('text', {
attrs: {
// 'active' and 'red' are dynamic classes, they can change between renders
// so we need to put them in the class attribute.
// (Normally we'd use the classModule, but it doesn't work inside SVG)
class: [isActive && "active", isColored && "red"].filter(Boolean).join(" ")
class: ["underline", isActive && "active", isColored && "red"].filter(Boolean).join(" ")
}
},
'Hello World'

Loading…
Cancel
Save