mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Fix matching of the :root structural pseudo-class
Root nodes either have no parents or are the single child of the document node.
This commit is contained in:
parent
755108cf95
commit
3ea1b30fd6
@ -738,10 +738,14 @@ match_element_selector(struct dom_select_node *selector, struct dom_node *node)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Root node are rooted at the don't have parent nodes. */
|
/* Root nodes either have no parents or are the single child of the
|
||||||
|
* document node. */
|
||||||
if (has_element_match(selector, DOM_SELECT_ELEMENT_ROOT)
|
if (has_element_match(selector, DOM_SELECT_ELEMENT_ROOT)
|
||||||
&& node->parent)
|
&& node->parent) {
|
||||||
return 0;
|
if (node->parent->type != DOM_NODE_DOCUMENT
|
||||||
|
|| node->parent->children->size > 1)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (has_element_match(selector, DOM_SELECT_ELEMENT_EMPTY)
|
if (has_element_match(selector, DOM_SELECT_ELEMENT_EMPTY)
|
||||||
&& node->data.element.map->size > 0)
|
&& node->data.element.map->size > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user