From 5d1432915df6ee9beb85fb1a25d712ecc2d9b1c6 Mon Sep 17 00:00:00 2001 From: Andrew Sidwell Date: Fri, 11 Jul 2008 17:28:11 +0000 Subject: Implement the "in scope" bit of "if is no element in scope that has a namespace other than the HTML namespace, switch the insertion mode to the secondary insertion mode". svn path=/trunk/hubbub/; revision=4610 --- src/treebuilder/in_foreign_content.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/treebuilder/in_foreign_content.c b/src/treebuilder/in_foreign_content.c index 043844b..b6f41dc 100644 --- a/src/treebuilder/in_foreign_content.c +++ b/src/treebuilder/in_foreign_content.c @@ -23,7 +23,19 @@ static bool element_in_scope_in_non_html_ns(hubbub_treebuilder *treebuilder) element_context *stack = treebuilder->context.element_stack; uint32_t node; - for (node = treebuilder->context.current_node; node != 0; node--) { + assert((signed) treebuilder->context.current_node >= 0); + + for (node = treebuilder->context.current_node; node > 0; node--) { + element_type node_type = stack[node].type; + + /* The list of element types given in the spec here are the + * scoping elements excluding TABLE and HTML. TABLE is handled + * in the previous conditional and HTML should only occur + * as the first node in the stack, which is never processed + * in this loop. */ + if (node_type == TABLE || is_scoping_element(node_type)) + break; + if (stack[node].ns != HUBBUB_NS_HTML) return true; } -- cgit v1.2.3