3 ms·
Good work. Question: Is it not the 'done thing' to use data attributes to hook in js functionality nowadays instead of using class attributes? This isn't a dig,
by jops 13y ago
Good work. Question: Is it not the 'done thing' to use data attributes to hook in js functionality nowadays instead of using class attributes? This isn't a dig, more of an intrigued to see what peoples' thoughts are on this.
- yeahbutbut 13y agoIn the standard case I agree (and I hope there is an option for that). I think the use case for this library is dropping it into a soup of HTML cooked up by a non-technical user. A programmer would have a JSON list to work with from the start. Could be totally off base here though, would love to see other takes on it.
- rpsw 13y agoIf the class names remain semantic, I don't think there is much harm using classes. The class names in the examples accurate describe the elements inner content. Querying by class over data attributes is also usually faster.
- Javve 13y agoWhen I made the first version 2 years ago I thought that classes would feel more natural to newbies, but since then have data-attributes become pretty much standard in the community. But today it's mostly a performance thing. List.js is supposed to be very fast and handle really long lists (check out http://sindresorhus.com/bower-components/ http://sindresorhus.com/bower-components/ it has 6000+ items)
- jops 13y agoExcellent example use in the wild thanks, demonstrates your point well. And good to see list.js in the list. Bower rules. http://sindresorhus.com/bower-components/#!/search/list.js http://sindresorhus.com/bower-components/#!/search/list.js