arturadib / agility

Javascript MVC for the "write less, do more" programmer
http://agilityjs.com
MIT License
542 stars 70 forks source link

$ is a valid js identifier character #81

Open colinmacc opened 12 years ago

colinmacc commented 12 years ago

And therefore parseBindStr's match regexp must be regex = /([a-zA-Z0-9$-]+)(?:[\s=]+([a-zA-Z0-9$_-]+))?/,

tristanls commented 12 years ago

I took a look at this. Attempting to put $ into attributes results in: INVALID_CHARACTER_ERR: DOM Exception 5

colinmacc commented 12 years ago

DOM attribute names can not have a $ in them, that is true. DOM attribute values, of course, can have $ in them.

Model component names, however, can have $ in them, and this is prevented by parseBindStr's match regexp where it should not be. It is perfectly valid to name a model component with a $, and there's no point AFAIK where that model component name maps to a DOM attribute name.

So the regexp used to determine which elements of the Model can be inserted into DOM elements should be as indicated, to permit the full range of javascript identifiers as names of Model components.