1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-15 23:35:34 +00:00

DOM: Cleanup the unused parts of the node interface

Take a quick stroll through the unchartered corners of the DOM node data
structures:

 - Remove ununsed struct dom_node_id_item.
 - Make the document node reference a future struct dom_document.
 - Describe ideas for node data, e.g. the entity reference node should use
 it for storing the unicode_val_T.
This commit is contained in:
Jonas Fonseca 2006-02-03 10:44:27 +01:00 committed by Jonas Fonseca
parent 8448472dcc
commit 4a27637529
2 changed files with 12 additions and 30 deletions

View File

@ -399,12 +399,6 @@ done_dom_node_data(struct dom_node *node)
break;
case DOM_NODE_DOCUMENT:
if (data->document.element_ids)
free_hash(data->document.element_ids);
if (data->document.meta_nodes)
done_dom_node_list(data->document.meta_nodes);
if (data->document.children)
done_dom_node_list(data->document.children);
break;
@ -444,7 +438,6 @@ done_dom_node(struct dom_node *node)
switch (parent->type) {
case DOM_NODE_DOCUMENT:
del_from_dom_node_list(data->document.meta_nodes, node);
del_from_dom_node_list(data->document.children, node);
break;

View File

@ -3,9 +3,9 @@
#define EL_DOM_NODE_H
#include "dom/string.h"
#include "util/hash.h"
struct dom_node_list;
struct dom_document;
enum dom_node_type {
DOM_NODE_UNKNOWN = 0, /* for internal purpose only */
@ -27,27 +27,15 @@ enum dom_node_type {
};
/* Following is the node specific datastructures. They may contain no more
* than 3 pointers or something equivalent. */
struct dom_node_id_item {
/* The attibute node containing the id value */
struct dom_node *id_attribute;
/* The node with the @id attribute */
struct dom_node *node;
};
* than 4 pointers or something equivalent. */
/* The document URI is stored in the string / length members. */
struct dom_document_node {
/* The document URI is stored in the string / length members. */
/* An id to node hash for fast lookup. */
struct hash *element_ids; /* -> {struct dom_node_id_item} */
/* Any meta data the root node carries such as document type nodes,
* entity and notation map nodes and maybe some internal CSS stylesheet
* node. */
struct dom_node_list *meta_nodes;
/* The document. */
struct dom_document *document;
/* The child nodes. May be NULL. Ordered like they where inserted. */
/* FIXME: Should be just one element (root) node reference. */
struct dom_node_list *children;
};
@ -176,12 +164,13 @@ union dom_node_data {
struct dom_id entity;
struct dom_proc_instruction_node proc_instruction;
/* Node types without a union member yet
/* Node types without a union member yet (mostly because it hasn't
* been necessary):
*
* DOM_NODE_CDATA_SECTION,
* DOM_NODE_COMMENT,
* DOM_NODE_DOCUMENT_FRAGMENT,
* DOM_NODE_ENTITY_REFERENCE,
* DOM_NODE_CDATA_SECTION: Use dom_text_node?
* DOM_NODE_DOCUMENT_FRAGMENT: struct dom_node_list children;
* DOM_NODE_ENTITY_REFERENCE: unicode_val_T
* DOM_NODE_COMMENT
*/
};