From db12dd2c03e303eda101b3307bca272af017b646 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 4 Nov 2011 21:52:24 +0000 Subject: Don't need to match CSS_SELECTOR_ELEMENT detail since it will always match. svn path=/trunk/libcss/; revision=13119 --- src/select/select.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/select/select.c b/src/select/select.c index dce813e..1851f47 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -1438,13 +1438,19 @@ css_error match_details(css_select_ctx *ctx, void *node, * can be avoided unless absolutely necessary)? */ do { - error = match_detail(ctx, node, detail, state, match, &pseudo); - if (error != CSS_OK) - return error; + /* Named elements are handled by match_named_combinator, so + * the element selector detail always matches here. */ + if (detail->type != CSS_SELECTOR_ELEMENT) { + + error = match_detail(ctx, node, detail, state, + match, &pseudo); + if (error != CSS_OK) + return error; - /* Detail doesn't match, so reject selector chain */ - if (*match == false) - return CSS_OK; + /* Detail doesn't match, so reject selector chain */ + if (*match == false) + return CSS_OK; + } if (detail->next) detail++; @@ -1485,8 +1491,7 @@ css_error match_detail(css_select_ctx *ctx, void *node, switch (detail->type) { case CSS_SELECTOR_ELEMENT: - error = state->handler->node_has_name(state->pw, node, - &detail->qname, match); + /* Never any need to match this detail type. */ break; case CSS_SELECTOR_CLASS: error = state->handler->node_has_class(state->pw, node, -- cgit v1.2.3