diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2007-09-23 00:37:44 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2007-09-23 00:37:44 +0000 |
commit | be0d8b580dd64fce2398d911adcbac9665369a7b (patch) | |
tree | 4ba7e89fbb69ad0b20f298ffe313a69a0437b380 | |
parent | 536f38a4aa7872e7801f5afebbc5659ad9c5264c (diff) | |
download | libdom-be0d8b580dd64fce2398d911adcbac9665369a7b.tar.gz libdom-be0d8b580dd64fce2398d911adcbac9665369a7b.tar.bz2 |
Fix dom_node_get_parent_node(), dom_node_get_previous_sibling() and dom_node_get_next_sibling() to return NULL for Attr nodes.
svn path=/trunk/dom/; revision=3579
-rw-r--r-- | src/core/node.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/node.c b/src/core/node.c index 8d1f16a..3a8af63 100644 --- a/src/core/node.c +++ b/src/core/node.c @@ -391,6 +391,12 @@ dom_exception dom_node_get_node_type(struct dom_node *node, dom_exception dom_node_get_parent_node(struct dom_node *node, struct dom_node **result) { + /* Attr nodes have no parent */ + if (node->type == DOM_ATTRIBUTE_NODE) { + *result = NULL; + return DOM_NO_ERR; + } + /* If there is a parent node, then increase its reference count */ if (node->parent != NULL) dom_node_ref(node->parent); @@ -484,6 +490,12 @@ dom_exception dom_node_get_last_child(struct dom_node *node, dom_exception dom_node_get_previous_sibling(struct dom_node *node, struct dom_node **result) { + /* Attr nodes have no previous siblings */ + if (node->type == DOM_ATTRIBUTE_NODE) { + *result = NULL; + return DOM_NO_ERR; + } + /* If there is a previous sibling, increase its reference count */ if (node->previous != NULL) dom_node_ref(node->previous); @@ -507,6 +519,12 @@ dom_exception dom_node_get_previous_sibling(struct dom_node *node, dom_exception dom_node_get_next_sibling(struct dom_node *node, struct dom_node **result) { + /* Attr nodes have no next siblings */ + if (node->type == DOM_ATTRIBUTE_NODE) { + *result = NULL; + return DOM_NO_ERR; + } + /* If there is a subsequent sibling, increase its reference count */ if (node->next != NULL) dom_node_ref(node->next); |