From 7259d8fa11f3fc45adbfa9634c145ba58f7f6257 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 24 Sep 2007 23:26:04 +0000 Subject: Move attributes field to struct dom_element as it doesn't apply to other node types. svn path=/trunk/dom/; revision=3590 --- src/core/node.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/core/node.c') diff --git a/src/core/node.c b/src/core/node.c index e8ebc34..ea957e4 100644 --- a/src/core/node.c +++ b/src/core/node.c @@ -157,7 +157,6 @@ dom_exception dom_node_initialise(struct dom_node *node, node->last_child = NULL; node->previous = NULL; node->next = NULL; - node->attributes = NULL; /* Note: nodes do not reference the document to which they belong, * as this would result in the document never being destroyed once @@ -232,7 +231,6 @@ void dom_node_finalise(struct dom_document *doc, struct dom_node *node) node->owner = NULL; /* Paranoia */ - node->attributes = NULL; node->next = NULL; node->previous = NULL; node->last_child = NULL; @@ -565,8 +563,7 @@ dom_exception dom_node_get_attributes(struct dom_node *node, return DOM_NO_ERR; } - return dom_document_get_namednodemap(node->owner, node, - DOM_ATTRIBUTE_NODE, result); + return dom_element_get_attributes((struct dom_element *) node, result); } /** @@ -1105,9 +1102,13 @@ dom_exception dom_node_get_local_name(struct dom_node *node, */ dom_exception dom_node_has_attributes(struct dom_node *node, bool *result) { - *result = node->attributes != NULL; + if (node->type != DOM_ELEMENT_NODE) { + *result = false; - return DOM_NO_ERR; + return DOM_NO_ERR; + } + + return dom_element_has_attributes((struct dom_element *) node, result); } /** -- cgit v1.2.3