Skip to content

Backport lexbor/lexbor#274 #18490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/dom/lexbor/lexbor/selectors-adapted/selectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Author: Alexander Borisov <[email protected]>
* Adapted for PHP + libxml2 by: Niels Dossche <[email protected]>
* Based on Lexbor 2.4.0 (upstream commit e9d35f6384de7bd8c1b79e7111bc3a44f8822967)
* Based on Lexbor (upstream commit b347aa4e4da4e82b1cae18989ceea1aa0278daf1)
*/

#include <libxml/xmlstring.h>
Expand Down Expand Up @@ -970,7 +970,7 @@ lxb_selectors_state_has_relative(const xmlNode *node,
break;
}

while (node !=root && node->next == NULL) {
while (node != root && node->next == NULL && node->parent != NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey you put an extra space compared to their version :P

node = node->parent;
}

Expand Down
13 changes: 13 additions & 0 deletions ext/dom/tests/modern/css_selectors/lexbor274.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Lexbor #274
--EXTENSIONS--
dom
--FILE--
<?php

$dom = Dom\HTMLDocument::createFromString('<html><body><div></div>\n</body></html>', LIBXML_NOERROR);
var_dump($dom->querySelector('a:has(+ b)'));

?>
--EXPECT--
NULL