3 ms·
Yes, I use data attributes all over! It lets me keep certain data and certain states in the DOM, and I can actually use querySelector to... you know, do a query
by wildrhythms 4y ago
Yes, I use data attributes all over! It lets me keep certain data and certain states in the DOM, and I can actually use querySelector to... you know, do a query based on data attribute values. I've met many devs who didn't know that CSS queries can actually string match within the values of attributes! (i.e. [attribute~="value"] and the other variations)
https://css-tricks.com/almanac/selectors/a/attribute/ https://css-tricks.com/almanac/selectors/a/attribute/