summaryrefslogtreecommitdiff
path: root/src/treebuilder/in_select_in_table.c
diff options
context:
space:
mode:
authorAndrew Sidwell <andy@entai.co.uk>2008-06-25 14:55:20 +0000
committerAndrew Sidwell <andy@entai.co.uk>2008-06-25 14:55:20 +0000
commitfb0d38d674ccc382ae097c2fe803da7595f02ec7 (patch)
tree1532653c089c5b6a9be7253843f9389a37d0322f /src/treebuilder/in_select_in_table.c
parente71c58d9fa5e365297527a90510923ad9a02e753 (diff)
downloadlibhubbub-fb0d38d674ccc382ae097c2fe803da7595f02ec7.tar.gz
libhubbub-fb0d38d674ccc382ae097c2fe803da7595f02ec7.tar.bz2
Implement the "in select in table" insertion mode.
svn path=/trunk/hubbub/; revision=4447
Diffstat (limited to 'src/treebuilder/in_select_in_table.c')
-rw-r--r--src/treebuilder/in_select_in_table.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/treebuilder/in_select_in_table.c b/src/treebuilder/in_select_in_table.c
new file mode 100644
index 0000000..54b9ab1
--- /dev/null
+++ b/src/treebuilder/in_select_in_table.c
@@ -0,0 +1,60 @@
+/*
+ * This file is part of Hubbub.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2008 Andrew Sidwell
+ */
+
+#include <assert.h>
+#include <string.h>
+
+#include "treebuilder/modes.h"
+#include "treebuilder/internal.h"
+#include "treebuilder/treebuilder.h"
+#include "utils/utils.h"
+
+
+/**
+ * Handle token in "in select in table" insertion mode
+ *
+ * \param treebuilder The treebuilder instance
+ * \param token The token to handle
+ * \return True to reprocess token, false otherwise
+ */
+bool handle_in_select_in_table(hubbub_treebuilder *treebuilder,
+ const hubbub_token *token)
+{
+ bool handled = false;
+ bool reprocess = false;
+
+ if (token->type == HUBBUB_TOKEN_END_TAG ||
+ token->type == HUBBUB_TOKEN_START_TAG) {
+ element_type type = element_type_from_name(treebuilder,
+ &token->data.tag.name);
+
+ if (type == CAPTION || type == TABLE || type == TBODY ||
+ type == TFOOT || type == THEAD || type == TR ||
+ type == TD || type == TH) {
+ /** \todo parse error */
+
+ handled = true;
+
+ if ((token->type == HUBBUB_TOKEN_END_TAG &&
+ element_in_scope(treebuilder, type,
+ true)) ||
+ token->type == HUBBUB_TOKEN_START_TAG) {
+ /** \todo fragment case */
+
+ element_stack_pop_until(treebuilder, SELECT);
+ reset_insertion_mode(treebuilder);
+ reprocess = true;
+ }
+ }
+ }
+
+ if (!handled) {
+ reprocess = process_in_select(treebuilder, token);
+ }
+
+ return reprocess;
+}