To target multiple classes with the same prefix, you'd typically have to resort to brittle attribute selectors. To make things easier, CSS is getting a new selector: the “Class Prefix Selector” (`.foo-*`). Check brm.us/class-prefix... to get the details. (Browser Support: None 😛 — just resolved!)
Post
brm.usThe Future of CSS: Target Multiple Classes with the Class Prefix SelectorTo target multiple classes that share the same prefix, you'd typically have to resort to brittle attribute selectors or add extra base classes to your markup. To make things easier, CSS is getting a n...
Indeed, it could mention why `[class|="foo"]` (even if relaxed as suggested) is also not quite the same as `[class^="foo-"], [class*=" foo-"]` or `.foo-*`.
0 reposts2 likes
I updated the post to include selector benchmark results: gist.github.com/bramus/1de3b...
gist.github.com`.btn` vs `[class^="btn-"]` vs `[class*=" btn-"]` performance`.btn` vs `[class^="btn-"]` vs `[class*=" btn-"]` performance - benchmark-results.txt
I added a section to the README that explains how to read the results of a benchmark: github.com/GoogleChrome... I hope this helps.
github.comGitHub - GoogleChromeLabs/css-selector-benchmark: CSS Selector Benchmarks, using PerfTestRunner and PuppeteerCSS Selector Benchmarks, using PerfTestRunner and Puppeteer - GoogleChromeLabs/css-selector-benchmark