Hacker News new | past | comments | ask | show | jobs | submit login

What does `data--my-cool-attribute` supposed to become?



The letter after - is uppercased, and the - is removed. So, `div.dataset.MyCoolAttribute`.


Won't that clash in this case, with the version that has double hypens?


I'm talking about your example with double hyphens. It's the initial double hyphen that causes the first letter to be uppercase.


> I'm talking about your example with double hyphens. It's the initial double hyphen that causes the first letter to be uppercase.

I was asking about the initial example, and made a mistake in the question I asked.

To clarify, according to the standards, what do the following transformations result in?

    data-my--cool-data
    data-my-cool-data


el.dataset['my-CoolData'] and el.dataset.myCoolData respectively




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: