Jeff wrote:
> Hello,
> I'm using PURE2 and I'm getting a "bad data selector syntax:
> forum.topic-count" error while trying to render this JSON object:
>
> {"forums": [{"title":"General Discussion","topic-count":20,"post-
> count":59},
> {"title":"Product Questions","topic-count":20,"post-
> count":59},
> {"title":"Customer Support","topic-count":20,"post-
> count":59}]}
>
> using this directive:
>
> var directive = {
> '.forum-entry': {
> 'forum <- forums': {
> '.title': 'forum.title',
> '.topic-count': 'forum.topic-count',
> '.post-count': 'forum.post-count'
> }
> }
> };
>
> $(".forum-list").autoRender(forums, directive)
>
> It renders correctly if I remove the hyphens from the names, so I
> narrowed down the problem to this regular expression on line 197 of
> pure2.js:
>
> var m = sel.match(/^(\w+)(\.(\w+))*$/);
>
Now I know that hyphen is not part of \w ;)
You're right the regexp is too restrictive and should allow it.
I've set an issue at
http://github.com/pure/pure/issues/#issue/7
You'll be able to follow the progress there.
Thanks for reporting.
Mic