lynaghk / singult

JavaScript Hiccup compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

merge! error: m.tag is undefined

soulne4ny opened this issue · comments

Hi!

I'm getting TypeError: m.tag is undefined ... (in FF) on (merge! container (render ...)). In Chrome it is Uncaught TypeError: Cannot call method 'toLowerCase' of undefined.
It seems that https://github.com/lynaghk/singult/blob/master/src/coffee/Singult.coffee#L259 should be like m.tagName.toLowerCase.

Thanks in advance :)

The merge! function takes a hiccup data structure, not another DOM node, which is what you're passing in via the render call.
The render function creates live DOM nodes and is useful for interop with other JavaScript libraries or if you want to do fancy stuff yourself; you don't need to use it if you are just using merge!.

I'll leave this open until you can verify the fix, though.

Also, just FYI, Singult is a bit low-level---a nicer interface for data<->DOM mapping is provided by C2's bind! function.

Thanks.
It was misuse of merge! merge! and render are working fine when are used properly :)