andyet/ICanHaz.js — Issue #44: Loading html fragments & template name issue
Author: toninoy
Created: 2012-01-27 19:21:46+00:00
State: open

Cheers!

First, kudos for nice library.
Setting it up was pretty much plug and play.

Now the issue I'm encountering:
I'm loading external files/html fragments/strings from the server with require.js.
In those files there's just raw html fragments, which are not enclosed into any script tags.
They are just raw strings. I load them via require.js text plugin, and it returns just raw string
( ``` 'text!templ/home/intro.html' ``` is how I load the template ).

After that, I just use that text/html fragment like this:
```ich.addTemplate('person', loadedHtmlText);
content = ich.person(dataobject);
this.el.html(content);```

Am I doing this properly?
'person' is not either previously declared anywhere, nor is it used as id of any script tags within templates, since
these html fragments have none, they are just raw html.

Anyway, the code is rendered as expected, it all works fine, however the console throws an error:
```[19:39:10.212] Invalid name: person. @ http://localhost/projekt/test1/js/libs/ICanHaz.js:472```

I'm using the latest repo version, converted with r.js command line tool into require.js module.
(I doubt it's the conversion to blame)

So, I'd just like to hear opinion.

I looked into code, it seems that on line 472, code that creates the issue is a test wether the name/string already exists?
However, my code doesn't have any other, same, already registered template/name.