Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I avoid all of the kebab/camel conversions by using the methods:

Element.hasAttribute('data-thing')

Element.getAttribute('data-thing')

Element.setAttribute('data-thing', '...')

Much more clear what I'm doing without the awkward translating when I inevitably have to inspect/debug in the DOM.



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

Search: