29 ms·
Very cool. It seems to be missing the begins with and ends with selectors for the attr-val. [title^=“old”] and [title$=“old”]
by hk1337 3y ago
Very cool. It seems to be missing the begins with and ends with selectors for the attr-val.
[title^=“old”]
and
[title$=“old”]
- reaperducer 3y ago[title^=“old”] and [title$=“old”] Once you get used to using these, and their relatives, you find all kinds of uses for them, like applying styles only to telephone links: a[href^="tel:"]
- hk1337 3y agoDefinitely, also, they're called CSS selectors but I use them a lot in javascript for query selection too.
- 6510 3y agoYou can do [data-foo*="banana"] and trigger it by changing the dataset to something that contains banana. https://jsfiddle.net/gaby_de_wilde/s729uk61/ https://jsfiddle.net/gaby_de_wilde/s729uk61/
- Technotroll 3y agoRegular selectors... (pun intended)
- deleted 3y ago[deleted]
- ttfkam 3y agoI'm constantly amused by how often regular expression syntax can be found in all sorts of unexpected places. It really is foundational knowledge these days. ^ means match input start $ means match input end Makes remembering the CSS selector syntax easier once you know that. (Or makes the regex syntax easier to remember?)