summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-09-23 00:57:49 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-09-23 00:57:49 +0000
commit0a5f955c7c23dfffe98ae8421c14418845c8bcb9 (patch)
tree5429e87d533d2290d7f9a9fadb86c82c0c977ad6 /src/core
parent34f4d422a253a529972918ac19b5551adab87d8f (diff)
downloadlibdom-0a5f955c7c23dfffe98ae8421c14418845c8bcb9.tar.gz
libdom-0a5f955c7c23dfffe98ae8421c14418845c8bcb9.tar.bz2
Fix dom_node_{get,set}_value() to handle Attr nodes correctly -- now delegates value accesses to the Attr-specific functions.
svn path=/trunk/dom/; revision=3581
Diffstat (limited to 'src/core')
-rw-r--r--src/core/node.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/node.c b/src/core/node.c
index 3a8af63..e8ebc34 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -8,6 +8,7 @@
#include <assert.h>
#include <stdbool.h>
+#include <dom/core/attr.h>
#include <dom/core/document.h>
#include <dom/core/string.h>
@@ -312,6 +313,10 @@ dom_exception dom_node_get_node_name(struct dom_node *node,
dom_exception dom_node_get_node_value(struct dom_node *node,
struct dom_string **result)
{
+ if (node->type == DOM_ATTRIBUTE_NODE) {
+ return dom_attr_get_value((struct dom_attr *) node, result);
+ }
+
if (node->value != NULL)
dom_string_ref(node->value);
@@ -351,6 +356,11 @@ dom_exception dom_node_set_node_value(struct dom_node *node,
if (_dom_node_readonly(node))
return DOM_NO_MODIFICATION_ALLOWED_ERR;
+ /* If it's an attribute node, then delegate setting to
+ * the type-specific function */
+ if (node->type == DOM_ATTRIBUTE_NODE)
+ return dom_attr_set_value((struct dom_attr *) node, value);
+
if (node->value != NULL)
dom_string_unref(node->value);