bem / bem/bem-xjst

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

Open
#258 3 comments 0 reactions 0 assignees View on GitHub
status: ready type: new feature
Dominant language
JavaScript
Stars
117
Forks
48
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the linked bem-xjst example and trace the HTML attribute-rendering entry point; done means data attributes render with single quotes, with the intended scope clarified for other attributes and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.