News for hackers. Stuff that matters.
Re:Things I Learned Reading Webkit’s UA Stylesheet by awestroke on Monday July 19, 2021 @11:51AM (#27883974)
The if statements are just cpp, executed at compile time

> Many of these are so custom to the webkit codebase, you won’t even find any results for them in Google

It's on Google, you just searched incorrectly

Re:Things I Learned Reading Webkit’s UA Stylesheet by no_way on Monday July 19, 2021 @12:20PM (#27884327)
Anything starting '-' won't show up on Google, it will literally give you empty results, so that's why -webkit-match-parent gives nothing and webkit-match-parent works.
Re:Things I Learned Reading Webkit’s UA Stylesheet by EMM_386 on Monday July 19, 2021 @01:15PM (#27885007)
Just surround anything prefixed with a "-" in quotes.

"-webkit-match-parent"

Re:Things I Learned Reading Webkit’s UA Stylesheet by blooalien on Monday July 19, 2021 @05:42PM (#27887581)
Ya beat me to it. There's all kinda good little search tricks like that besides just the quotes, too. Really effective search engine research skills are almost an art-form these days. ;)
Re:Things I Learned Reading Webkit’s UA Stylesheet by Hello71 on Monday July 19, 2021 @02:22PM (#27885723)
this reminds me of https://nautil.us/blog/impossibly-hungry-judges: google has the majority of github repos indexed (although isn't always great at giving you the best result), and webkit is a pretty popular software. unless this parameter was added to the codebase literally minutes ago, google should have at least some results. the fact that absolutely no results show up means that something is either wrong with google, or more likely, your query.
Re:Things I Learned Reading Webkit’s UA Stylesheet by inlikealamb on Monday July 19, 2021 @09:43PM (#27889277)
It's a Google feature that isn't very smart... adding a dash before a word will exclude results containing that word

I suspect it trips up people that don't know this more than it's actually used.

Re:Things I Learned Reading Webkit’s UA Stylesheet by DonHopkins on Tuesday July 20, 2021 @06:40AM (#27892110)
It's not that the "-" prefix is just a harmless undocumented feature that only (a few) people who know about it use, it's more that it's an insidious undocumented foot gun that shoots (most) people who don't know about it when they use it accidentally.

Google should at least show a user friendly help message at the top of the page, that actually teaches users about the filtering feature, and lets you turn it off, like:

    Results containing "webkit-match-parent" omitted because of "-" prefix. (Click to include.)
But that would reduce the ad surface area by a tiny amount, so oh well...
Re:Things I Learned Reading Webkit’s UA Stylesheet by inlikealamb on Tuesday July 20, 2021 @09:22AM (#27893352)
They'd probably solve most of their problems by simply recognizing that a single term with a - isn't an exclusion, because it returns no results. That's like... a 10 minute regex fix
Re:Things I Learned Reading Webkit’s UA Stylesheet by lights0123 on Monday July 19, 2021 @12:19PM (#27884321)
Specifically, prefixing a term with a "-" excludes results with that term, though I would expect for it to be ignored if it's the only term in the query.
Re:Things I Learned Reading Webkit’s UA Stylesheet by arthur2e5 on Monday July 19, 2021 @02:57PM (#27886108)
Developers going without knowing what preprocessors do is… getting unfortunately common. Back in the olden days some people were using the C preprocessor on JavaScript. Being bilingual helps in programming too, everyone!
Re:Things I Learned Reading Webkit’s UA Stylesheet by nicoburns on Monday July 19, 2021 @03:36PM (#27886477)
> getting unfortunately common

I would say fortunately common. The sooner the C preprocessor (and C itself for that matter) can die, the better for everybody.

Re:Things I Learned Reading Webkit’s UA Stylesheet by azinman2 on Monday July 19, 2021 @04:51PM (#27887120)
Compiler macros are not unique to C, and are even in “modern” languages like Swift and NIM. They solve specific problems usefully that often have no other good solution.

Don’t remove it, improve it!

Re:Things I Learned Reading Webkit’s UA Stylesheet by nicoburns on Monday July 19, 2021 @05:23PM (#27887411)
Sure, but macros in other languages are hygienic rather than copy-paste systems, and are therefore much safer (and easier to use for complex use cases, although the C preprocessor might be easier for really simple cases).