diff options
author | rsk1994 <rsk1coder99@gmail.com> | 2014-05-18 07:57:15 +0530 |
---|---|---|
committer | Rupinder Singh Khokhar <rsk1coder99@gmail.com> | 2014-06-11 04:27:09 +0530 |
commit | 2c4fcd2e416c51dc95af1e9054df1dc1fa28ff25 (patch) | |
tree | 76c0d0a8f2bdd3fe9835d8971bc3fe3a788a76ea /src/html/html_map_element.c | |
parent | efec9dd5e88f563242a645e0a1f1904f5c262093 (diff) | |
download | libdom-2c4fcd2e416c51dc95af1e9054df1dc1fa28ff25.tar.gz libdom-2c4fcd2e416c51dc95af1e9054df1dc1fa28ff25.tar.bz2 |
[Map Element Rev.2(fix)] & [Script Element add]
Diffstat (limited to 'src/html/html_map_element.c')
-rw-r--r-- | src/html/html_map_element.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/html/html_map_element.c b/src/html/html_map_element.c index bdd4ef0..cf0fe5e 100644 --- a/src/html/html_map_element.c +++ b/src/html/html_map_element.c @@ -165,10 +165,13 @@ SIMPLE_GET_SET(name); /* The callback function for _dom_html_collection_create*/ bool callback(struct dom_node_internal *node, void *ctx) { - if(dom_string_caseless_isequal - (node->name,((dom_html_document *)ctx)->memoised[hds_AREA])) { + if(node->type == DOM_ELEMENT_NODE && + dom_string_caseless_isequal(node->name, + ((dom_html_document *)ctx)->memoised[hds_AREA])) + { return true; } + return false; } @@ -185,12 +188,8 @@ dom_exception dom_html_map_element_get_areas( { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) ele)->owner; - dom_node_internal *root = ((dom_node_internal *) ele); - - while (root->parent != NULL) { - root = root->parent; - } - - return _dom_html_collection_create(doc, root, - callback, (void *)doc, areas); + + /*doc is passed as a parameter to callback to avoid repeated calculations */ + return _dom_html_collection_create(doc, (dom_node_internal *) ele, + callback, (void *) doc, areas); } |