ckirkendall / kioo

Enlive/Enfocus style templating for Facebook's React and Om in ClojureScript.
Eclipse Public License 1.0
403 stars 39 forks source link

add-class doesn't work if class attribute not previously defined in HTML #19

Closed andrew-nguyen closed 10 years ago

andrew-nguyen commented 10 years ago

If the HTML is

...
<li>something</li>
...

then

...
[:li] (add-class "some-class")
...

throws an error.

Currently, the simple workaround is to add 'class=""'.

I don't know what the intended semantics of "add-class" are but I had assumed that you can "add" the first class.

ckirkendall commented 10 years ago

@andrew-nguyen Can you post the error you are seeing?

andrew-nguyen commented 10 years ago

@ckirkendall How much detail would you like? The top-level error is:

Uncaught TypeError: Cannot read property 'match' of null

I don't have source-maps enabled right now but the stack goes from the offending line in my code to core

ckirkendall commented 10 years ago

Ok, that is what I thought I will fix this as soon as I can. It is being thrown by has-class? and is due to passing null to the regular expression check.

Creighton

On Wed, Apr 23, 2014 at 2:34 PM, Andrew Nguyen notifications@github.comwrote:

@ckirkendall https://github.com/ckirkendall How much detail would you like? The top-level error is:

Uncaught TypeError: Cannot read property 'match' of null

I don't have source-maps enabled right now but the stack goes from the offending line in my code to core

— Reply to this email directly or view it on GitHubhttps://github.com/ckirkendall/kioo/issues/19#issuecomment-41197913 .

ckirkendall commented 10 years ago

This was actually fixed some time ago. I pushed the 0.4.0 version out and the fix should be present in there.