diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2012-03-25 11:14:19 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2012-03-25 11:14:19 +0000 |
commit | 6ff2da6e311c8a02ba1d9ab5f760511a3039982f (patch) | |
tree | 8cb6db7f8b31d169c455122a5c14be76a0eb1c8e /css/select.c | |
parent | dbfdaa3144f57e3854c56aadd2f0ed275ca605ef (diff) | |
download | netsurf-6ff2da6e311c8a02ba1d9ab5f760511a3039982f.tar.gz netsurf-6ff2da6e311c8a02ba1d9ab5f760511a3039982f.tar.bz2 |
fix node_is_link
add dom string globals to css handler
svn path=/trunk/netsurf/; revision=13678
Diffstat (limited to 'css/select.c')
-rw-r--r-- | css/select.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/css/select.c b/css/select.c index b87bbfc3d..c8a395ba6 100644 --- a/css/select.c +++ b/css/select.c @@ -1627,20 +1627,36 @@ css_error node_is_empty(void *pw, void *node, bool *match) * Callback to determine if a node is a linking element. * * \param pw HTML document - * \param node DOM node + * \param n DOM node * \param match Pointer to location to receive result * \return CSS_OK. * * \post \a match will contain true if the node matches and false otherwise. */ -css_error node_is_link(void *pw, void *node, bool *match) +css_error node_is_link(void *pw, void *n, bool *match) { -#ifdef FIXME - xmlNode *n = node; + dom_node *node = n; + dom_exception exc; + dom_string *node_name = NULL; + + exc = dom_node_get_node_name(node, &node_name); + if ((exc != DOM_NO_ERR) || (node_name == NULL)) { + return CSS_NOMEM; + } + + if (dom_string_caseless_isequal(node_name, nscss_dom_string_a)) { + bool has_href; + exc = dom_element_has_attribute(node, nscss_dom_string_href, &has_href); + if ((exc == DOM_NO_ERR) && (has_href)) { + *match = true; + } else { + *match = false; + } + } else { + *match = false; + } + dom_string_unref(node_name); - *match = (strcasecmp((const char *) n->name, "a") == 0 && - xmlHasProp(n, (const xmlChar *) "href") != NULL); -#endif return CSS_OK; } |