[php-src] PR #23613: Feature: Implement Prototype.js DOM traversal methods (GH-23575)

From: Date: Tue, 08 Sep 2026 10:13:18 +0000
Subject: [php-src] PR #23613: Feature: Implement Prototype.js DOM traversal methods (GH-23575)
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38381@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23613 Author: prateekbhujel Fixes GH-23575. I saw the comments about this being too complex to warrant adding to the extension, so I decided to just write the C code and see what it would actually take. Turns out it doesn't add much complexity at all. We can just aggressively reuse the existing lexbor CSS selector engine (lxb_selectors_match_node). I added up(), down(), next(), previous(), and siblings() directly to Dom\Element. It hooks right into the exact same logic querySelector and closest use, so there's almost zero C bloat and the traversal is extremely fast (it aborts matching immediately when the target index is hit). Added standard ValueErrors for negative indices and dropped in a test suite.

« previous php.git-pulls (#38381) next »