diff options
author | Andrew Sidwell <andy@entai.co.uk> | 2008-07-11 17:28:11 +0000 |
---|---|---|
committer | Andrew Sidwell <andy@entai.co.uk> | 2008-07-11 17:28:11 +0000 |
commit | 5d1432915df6ee9beb85fb1a25d712ecc2d9b1c6 (patch) | |
tree | 3ba676a7102714c394b3fb9c6ace669f852b9ce5 /src/treebuilder/in_foreign_content.c | |
parent | dfcca7a515cb0c9e3c2fed57d2f08b377df4ab8c (diff) | |
download | libhubbub-5d1432915df6ee9beb85fb1a25d712ecc2d9b1c6.tar.gz libhubbub-5d1432915df6ee9beb85fb1a25d712ecc2d9b1c6.tar.bz2 |
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
Diffstat (limited to 'src/treebuilder/in_foreign_content.c')
-rw-r--r-- | src/treebuilder/in_foreign_content.c | 14 |
1 files changed, 13 insertions, 1 deletions
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; } |