bem / bem-xjst

bem-xjst (eXtensible JavaScript Templates): declarative template engine for the browser and server
https://bem.github.io/bem-xjst
Other
115 stars 47 forks source link

Use single-quotes for data-attributes (or all attributes) #258

Open St-Lukas opened 8 years ago

St-Lukas commented 8 years ago

Content of data-attributes is often JSON-serialized string. So if double-quotes is used in attributes then data-attributes are escaped with overhead and looks unreadable because JSON-serialization uses double quotes too. Example: http://bem.github.io/bem-xjst/?bemhtml=%20&bemjson=%7B%0A%20%20%20%20block%3A%20%27a%27%2C%0A%20%20%20%20attrs%3A%20%7B%0A%20%20%20%20%20%20%20%20%27data-info%27%3A%20%27%7B%22a%22%3A%22b%22%7D%27%0A%20%20%20%20%7D%0A%7D

St-Lukas commented 8 years ago

cc @miripiruni

miripiruni commented 8 years ago

See: https://github.com/bem/bem-xjst/blob/master/lib/bemhtml/index.js#L172

miripiruni commented 6 years ago

Related: https://github.com/bem/bem-xjst/pull/504