summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-09-22 17:38:47 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-09-22 17:38:47 +0000
commit6837c5789f492460f610a4ce074606eac5268a98 (patch)
tree2a62d142e1e2f1e3b7ae0a0a0bd717513c495ebd /src/core
parent3aeb8ed101f4f575240a2fce48346b811371c19e (diff)
downloadlibdom-6837c5789f492460f610a4ce074606eac5268a98.tar.gz
libdom-6837c5789f492460f610a4ce074606eac5268a98.tar.bz2
Implement dom_node_get_child_nodes()
Implement dom_node_get_attributes() svn path=/trunk/dom/; revision=3570
Diffstat (limited to 'src/core')
-rw-r--r--src/core/node.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/core/node.c b/src/core/node.c
index eab1809..db65fab 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -408,15 +408,21 @@ dom_exception dom_node_get_parent_node(struct dom_node *node,
* \param result Pointer to location to receive child list
* \return DOM_NO_ERR.
*
- * \todo Work out reference counting semantics of dom_nodelist
+ * The returned NodeList will be referenced. It is the responsibility
+ * of the caller to unref the list once it has finished with it.
*/
dom_exception dom_node_get_child_nodes(struct dom_node *node,
struct dom_nodelist **result)
{
- UNUSED(node);
- UNUSED(result);
+ /* Can't do anything without an owning document.
+ * This is only a problem for DocumentType nodes
+ * which are not yet attached to a document.
+ * DocumentType nodes have no children, anyway. */
+ if (node->owner == NULL)
+ return DOM_NOT_SUPPORTED_ERR;
- return DOM_NOT_SUPPORTED_ERR;
+ return dom_document_get_nodelist(node->owner, node,
+ NULL, NULL, NULL, result);
}
/**
@@ -518,15 +524,22 @@ dom_exception dom_node_get_next_sibling(struct dom_node *node,
* \param result Pointer to location to receive attribute map
* \return DOM_NO_ERR.
*
- * \todo Work out reference counting semantics of dom_namednodemap
+ * The returned NamedNodeMap will be referenced. It is the responsibility
+ * of the caller to unref the map once it has finished with it.
+ *
+ * If ::node is not an Element, then NULL will be returned.
*/
dom_exception dom_node_get_attributes(struct dom_node *node,
struct dom_namednodemap **result)
{
- UNUSED(node);
- UNUSED(result);
+ if (node->type != DOM_ELEMENT_NODE) {
+ *result = NULL;
- return DOM_NOT_SUPPORTED_ERR;
+ return DOM_NO_ERR;
+ }
+
+ return dom_document_get_namednodemap(node->owner, node,
+ DOM_ATTRIBUTE_NODE, result);
}
/**