frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

CSS as a Query Language

https://evdc.me/blog/css-query
25•evnc•2h ago

Comments

efortis•1h ago
Not sure I follow the scenario this would solve.

For instance, currently you can conditionally change a parent based on its children. For example, this `pre` could either have 16px or 0px of padding. Zero when its direct child is a `code` element.

  pre {
    padding: 16px;

    &:has(> code) {
      padding: 0;
    }
  }
tadfisher•55m ago
The article describes a syntax for modifying the underlying data (adding new child elements or attributes to the DOM) for matching selectors, not resolving style changes in a single pass like you've shown.
capitainenemo•39m ago
I suspect they are replying to this part of the article: "What you actually want to say is: “an element is effectively-dark if it has data-theme=”dark”, or if it has an effectively-dark ancestor with no effectively-light ancestor in between.” That’s a recursive relational definition. CSS cannot express it. CSSLog can:"

The entire article doesn't seem to mention the existence of :has() which is rather surprising given how recently it was written. Not even in the footnotes.

evnc•15m ago
tbh, this started as a connection of two disparate ideas ("hey, this thing looks like this other thing"), and then just kind of explores it in different directions.

I think the conclusion (which I may not have made clear enough) is less like "These are limitations of modern CSS which ought to be fixed" and more "Maybe a CSS-like syntax could be added to a Datalog-like system and that would be helpful for making it more accessible to more engineers, navigating tree-shaped data, etc"

thanks for the feedback, anyway!

k1m•1h ago
I find CSS selectors a lot easier to write than XPath. I recently gave a talk on how PHP's new DOM API makes working with HTML and CSS selectors natively very easy (previously you had to convert CSS to XPath).[1]

It's a shame that because CSS is still primarily for browser use and styling, we don't get nice things like the ability to select based on text content like we can with XPath. My understanding is that this was proposed but didn't make it into the spec because it could lead to performance issues in a browser rendering context.

[1] https://speakerdeck.com/keyvan/parsing-html-with-php-8-dot-4...

zerocrates•1h ago
Yeah, querySelector/querySelectorAll are totally widespread in client-side, it's nice to finally have them in PHP's newer DOM. Definitely what people are used to doing.
werdnapk•21m ago
document.evaluate is also widespread client-side.

https://developer.mozilla.org/en-US/docs/Web/API/Document/ev...

duncanfwalker•54m ago
Reminds me of seeing this presented at a conference years ago https://github.com/braposo/graphql-css

It was a joke but I really like the way it pointed out how we copy and reapply patterns in different contexts and that might enable unexpected things.

evnc•13m ago
oh this is fun

> we copy and reapply patterns in different contexts and that might enable unexpected things

yeah, that's exactly what I am trying to do here. Mostly it doesn't go anywhere, but it's interesting for the hacker spirit within me :)

spookylukey•38m ago
The project pyastgrep https://pyastgrep.readthedocs.io/en/latest/ can use CSS selectors as a query language for Python syntax (default is XPath).

e.g.:

pyastgrep --css 'Call > func > Name#main'

evnc•19m ago
oh this is neat! Feels like exactly the sort of thing I was gesturing towards. Thanks :)
securityTalent•8m ago
Nice

OpenAI releases GPT-5.5 and GPT-5.5 Pro in the API

https://developers.openai.com/api/docs/changelog
86•arabicalories•1h ago•43 comments

Sabotaging projects by overthinking, scope creep, and structural diffing

https://kevinlynagh.com/newsletter/2026_04_overthinking/
275•alcazar•5h ago•67 comments

SFO Quiet Airport (2025)

https://viewfromthewing.com/san-francisco-airport-removed-90-minutes-of-daily-noise-travelers-say...
47•CaliforniaKarl•1h ago•28 comments

SDL Now Supports DOS

https://github.com/libsdl-org/SDL/pull/15377
148•Jayschwa•3h ago•55 comments

I Cancelled Claude: Token Issues, Declining Quality, and Poor Support

https://nickyreinert.de/en/2026/2026-04-24-claude-critics/
550•y42•3h ago•324 comments

DeepSeek v4

https://api-docs.deepseek.com/
1697•impact_sy•16h ago•1316 comments

The Classic American Diner

https://blogs.loc.gov/picturethis/2026/04/the-classic-american-diner/
23•NaOH•56m ago•5 comments

Diatec, known for its mechanical keyboard brand FILCO, has ceased operations

https://gigazine.net/gsc_news/en/20260424-filco-diatec/
39•gslin•3h ago•13 comments

How to be anti-social – a guide to incoherent and isolating social experiences

https://nate.leaflet.pub/3mk4xkaxobc2p
232•calcifer•9h ago•233 comments

Different Language Models Learn Similar Number Representations

https://arxiv.org/abs/2604.20817
73•Anon84•5h ago•30 comments

I'm done making desktop applications (2009)

https://www.kalzumeus.com/2009/09/05/desktop-aps-versus-web-apps/
107•claxo•4h ago•111 comments

CC-Canary: Detect early signs of regressions in Claude Code

https://github.com/delta-hq/cc-canary
13•tejpalv•2h ago•4 comments

CSS as a Query Language

https://evdc.me/blog/css-query
25•evnc•2h ago•12 comments

Spinel: Ruby AOT Native Compiler

https://github.com/matz/spinel
268•dluan•11h ago•77 comments

Physicists revive 1990s laser concept to propose a next-generation atomic clock

https://phys.org/news/2026-04-physicists-revive-1990s-laser-concept.html
41•wglb•19h ago•5 comments

Show HN: Browser Harness – Gives LLM freedom to complete any browser task

https://github.com/browser-use/browser-harness
47•gregpr07•5h ago•23 comments

My audio interface has SSH enabled by default

https://hhh.hn/rodecaster-duo-fw/
3•hhh•26m ago•0 comments

US special forces soldier arrested after allegedly winning $400k on Maduro raid

https://www.cnn.com/2026/04/23/politics/us-special-forces-soldier-arrested-maduro-raid-trade
609•nkrisc•22h ago•658 comments

Redesigning the Recurse Center application to inspire curious programmers

https://www.recurse.com/blog/192-redesigning-the-recurse-center-application
36•nicholasjbs•3h ago•5 comments

The operating cost of adult and gambling startups

https://orchidfiles.com/stigma-is-a-tax-on-every-operational-decision/
86•theorchid•7h ago•129 comments

Machine Learning Reveals Unknown Transient Phenomena in Historic Images

https://arxiv.org/abs/2604.18799
43•solarist•5h ago•32 comments

Hear your agent suffer through your code

https://github.com/AndrewVos/endless-toil
160•AndrewVos•8h ago•76 comments

Mounting tar archives as a filesystem in WebAssembly

https://jeroen.github.io/notes/webassembly-tar/
101•datajeroen•9h ago•33 comments

An update on recent Claude Code quality reports

https://www.anthropic.com/engineering/april-23-postmortem
897•mfiguiere•1d ago•673 comments

Bitwarden CLI compromised in ongoing Checkmarx supply chain campaign

https://socket.dev/blog/bitwarden-cli-compromised
843•tosh•1d ago•411 comments

Norway Set to Become Latest Country to Ban Social Media for Under 16s

https://www.bloomberg.com/news/articles/2026-04-24/norway-wants-kids-to-be-kids-with-social-media...
316•1vuio0pswjnm7•5h ago•320 comments

GPT-5.5

https://openai.com/index/introducing-gpt-5-5/
1507•rd•1d ago•1009 comments

Why I Write (1946)

https://www.orwellfoundation.com/the-orwell-foundation/orwell/essays-and-other-works/why-i-write/
255•RyanShook•17h ago•68 comments

Tesla (TSLA) discloses $2B AI hardware company acquisition buried

https://electrek.co/2026/04/23/tesla-tsla-quietly-discloses-2-billion-ai-hardware-acquisition-10q/
56•Bender•3h ago•39 comments

Refuse to let your doctor record you

https://buttondown.com/maiht3k/archive/why-you-should-refuse-to-let-your-doctor-record/
117•speckx•4h ago•123 comments