1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -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:
Jonas Fonseca 2005-12-23 00:59:56 +01:00 committed by Jonas Fonseca
parent 755108cf95
commit 3ea1b30fd6

View File

@ -738,10 +738,14 @@ match_element_selector(struct dom_select_node *selector, struct dom_node *node)
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)
&& node->parent)
&& node->parent) {
if (node->parent->type != DOM_NODE_DOCUMENT
|| node->parent->children->size > 1)
return 0;
}
if (has_element_match(selector, DOM_SELECT_ELEMENT_EMPTY)
&& node->data.element.map->size > 0)