diff --git a/src/document/dom/stack.c b/src/document/dom/stack.c
index cc184a432..a0d788069 100644
--- a/src/document/dom/stack.c
+++ b/src/document/dom/stack.c
@@ -137,12 +137,6 @@ do_pop_dom_node(struct dom_stack *stack, struct dom_stack_state *parent)
if (!dom_stack_has_parents(stack)) return 0;
state = get_dom_stack_top(stack);
- if (state->callback) {
- void *state_data = get_dom_stack_state_data(stack, state);
-
- /* Pass the node we are popping to and _not_ the state->node */
- state->callback(stack, parent->node, state_data);
- }
stack->depth--;
assert(stack->depth >= 0);
diff --git a/src/document/dom/stack.h b/src/document/dom/stack.h
index 126bce0f9..57bb7726c 100644
--- a/src/document/dom/stack.h
+++ b/src/document/dom/stack.h
@@ -24,10 +24,6 @@ struct dom_stack_state {
/* The index (in the list above) which are currently being handled. */
size_t index;
- /* A callback registered to be called when the node is popped. Used for
- * correctly highlighting ending elements (e.g. ). */
- dom_stack_callback_T callback;
-
/* The depth of the state in the stack. This is amongst other things
* used to get the state object data. */
unsigned int depth;
diff --git a/src/document/sgml/html/html.c b/src/document/sgml/html/html.c
index 28cad646c..63157fc56 100644
--- a/src/document/sgml/html/html.c
+++ b/src/document/sgml/html/html.c
@@ -37,66 +37,7 @@ static struct sgml_node_info html_elements[HTML_ELEMENTS] = {
};
-static struct dom_node *
-add_html_element_end_node(struct dom_stack *stack, struct dom_node *node, void *data)
-{
- struct sgml_parser *parser = stack->parser;
- struct dom_node *parent;
- struct scanner_token *token;
-
- assert(stack && parser && node);
- assert(dom_stack_has_parents(stack));
-
- /* Are we the actual node being popped? */
- if (node != get_dom_stack_top(stack)->node)
- return NULL;
-
- parent = get_dom_stack_parent(stack)->node;
- token = get_scanner_token(&parser->scanner);
-
- assertm(token, "No token found in callback");
- assertm(token->type == SGML_TOKEN_ELEMENT_END, "Bad token found in callback");
-
- if (!token->length) return NULL;
-
- return add_dom_element(parent, token->string, token->length);
-}
-
-/* TODO: We need to handle ascending of
and "
text1
text2" using data - * from sgml_node_info. */ -static struct dom_node * -add_html_element_node(struct dom_stack *stack, struct dom_node *node, void *data) -{ - struct sgml_parser *parser = stack->parser; - - assert(stack && node); - assert(dom_stack_has_parents(stack)); - - /* TODO: Move to SGML parser main loop and disguise these element ends - * in some internal processing instruction. */ - if (parser->flags & SGML_PARSER_ADD_ELEMENT_ENDS) - get_dom_stack_top(stack)->callback = add_html_element_end_node; - - return node; -} - - struct sgml_info sgml_html_info = { html_attributes, html_elements, - { - /* */ NULL, - /* DOM_NODE_ELEMENT */ add_html_element_node, - /* DOM_NODE_ATTRIBUTE */ NULL, - /* DOM_NODE_TEXT */ NULL, - /* DOM_NODE_CDATA_SECTION */ NULL, - /* DOM_NODE_ENTITY_REFERENCE */ NULL, - /* DOM_NODE_ENTITY */ NULL, - /* DOM_NODE_PROC_INSTRUCTION */ NULL, - /* DOM_NODE_COMMENT */ NULL, - /* DOM_NODE_DOCUMENT */ NULL, - /* DOM_NODE_DOCUMENT_TYPE */ NULL, - /* DOM_NODE_DOCUMENT_FRAGMENT */ NULL, - /* DOM_NODE_NOTATION */ NULL, - } }; diff --git a/src/document/sgml/parser.c b/src/document/sgml/parser.c index 0f86a77c4..7f1ef015d 100644 --- a/src/document/sgml/parser.c +++ b/src/document/sgml/parser.c @@ -311,10 +311,7 @@ init_sgml_parser(enum sgml_parser_type type, struct cache_entry *cached, parser->cache_entry = cached; parser->info = &sgml_html_info; - init_dom_stack(&parser->stack, parser, NULL, parser->info->callbacks, obj_size); - - if (document->options.plain) - parser->flags |= SGML_PARSER_ADD_ELEMENT_ENDS; + init_dom_stack(&parser->stack, parser, NULL, NULL, obj_size); return parser; } diff --git a/src/document/sgml/parser.h b/src/document/sgml/parser.h index 101a5afe3..2225fafd3 100644 --- a/src/document/sgml/parser.h +++ b/src/document/sgml/parser.h @@ -23,14 +23,9 @@ enum sgml_parser_type { SGML_PARSER_STREAM, }; -enum sgml_parser_flags { - SGML_PARSER_ADD_ELEMENT_ENDS = 1, -}; - struct sgml_parser { enum sgml_parser_type type; - /* The parser flags controls what gets added to the DOM tree */ - enum sgml_parser_flags flags; + struct sgml_info *info; struct document *document; diff --git a/src/document/sgml/sgml.h b/src/document/sgml/sgml.h index a33e54b68..a2b5ccba0 100644 --- a/src/document/sgml/sgml.h +++ b/src/document/sgml/sgml.h @@ -76,7 +76,6 @@ get_sgml_node_info(struct sgml_node_info list[], struct dom_node *node) struct sgml_info { struct sgml_node_info *attributes; struct sgml_node_info *elements; - dom_stack_callback_T callbacks[DOM_NODES]; }; #endif