batiste / pug-vdom

PUG template to HyperScript Virtual DOM
MIT License
18 stars 6 forks source link

Class attribute can't be repeated #22

Closed matejcik closed 6 years ago

matejcik commented 6 years ago

the following pug:

.foo(class="bar" class=["baz"] class={qux: true}) xyz

is supposed to render like this:

<div class="foo bar baz qux">xyz</div>

with pug-vdom, the element is:

var n1 = h('div', {'class': 'foo', 'class': "bar", 'class':  ["baz"], 'class': {qux: true}}, n1Child)

(funnily enough, there's two kinds of quotes in use too :) )


I would be OK with not supporting the repeating and mix-and-match proof of concept that I wrote here. My usecase is actually this:

.default(class=someobject) xyz

IOW, specify a class literal and add other classes via a single nonrepeated class attribute

matejcik commented 6 years ago

hmmm this is apparently fixed in git

gryphonmyers commented 6 years ago

Oh do you mean the npm package is out of date? That's entirely possible I did a lot of stuff affecting the way classes are parsed in recent commits. We should make sure the npm package is up to date

batiste commented 6 years ago

@matejcik I update the package to 1.0.4