summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsk1994 <rsk1coder99@gmail.com>2014-05-21 06:46:24 (GMT)
committer Rupinder Singh Khokhar <rsk1coder99@gmail.com>2014-06-10 22:57:10 (GMT)
commitca30ba7de4c3b0b17a61e1f07032575a01f2cd25 (patch)
tree54a84eeed5201b0fef2a90ee1997dd848468a1fa
parent16ceb174a3eca4e93f9ecc72296332b1d6ceba60 (diff)
downloadlibdom-ca30ba7de4c3b0b17a61e1f07032575a01f2cd25.tar.gz
libdom-ca30ba7de4c3b0b17a61e1f07032575a01f2cd25.tar.bz2
TableSection Element Rev.1
-rw-r--r--Makefile1
-rw-r--r--include/dom/dom.h1
-rw-r--r--include/dom/html/html_tablesection_element.h50
-rw-r--r--src/html/Makefile4
-rw-r--r--src/html/TODO4
-rw-r--r--src/html/html_document.c6
-rw-r--r--src/html/html_tablesection_element.c312
-rw-r--r--src/html/html_tablesection_element.h47
-rw-r--r--test/DOMTSHandler.pm1
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement01.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement01.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement02.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement02.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement03.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement03.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement04.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement04.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement05.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement05.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement06.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement06.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement07.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement07.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement08.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement08.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement09.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement09.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement10.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement10.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement11.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement11.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableSectionElement12.xml (renamed from test/testcases/tests/level1/html/HTMLTableSectionElement12.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableSectionElement25.xml (renamed from test/testcases/tests/level2/html/HTMLTableSectionElement25.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableSectionElement26.xml (renamed from test/testcases/tests/level2/html/HTMLTableSectionElement26.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableSectionElement27.xml (renamed from test/testcases/tests/level2/html/HTMLTableSectionElement27.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableSectionElement28.xml (renamed from test/testcases/tests/level2/html/HTMLTableSectionElement28.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableSectionElement29.xml (renamed from test/testcases/tests/level2/html/HTMLTableSectionElement29.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableSectionElement30.xml.kfail55
-rw-r--r--test/testcases/tests/level2/html/HTMLTableSectionElement31.xml.kfail53
-rw-r--r--test/testcases/tests/level2/html/files/tablesection.html62
-rw-r--r--test/testcases/tests/level2/html/files/tablesection.xhtml65
-rw-r--r--test/testcases/tests/level2/html/files/tablesection.xml65
31 files changed, 614 insertions, 112 deletions
diff --git a/Makefile b/Makefile
index 52c0035..0745e10 100644
--- a/Makefile
+++ b/Makefile
@@ -126,6 +126,7 @@ INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_script_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablecaption_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablecell_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablecol_element.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablesection_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in
INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT)
diff --git a/include/dom/dom.h b/include/dom/dom.h
index 51d12c4..071ca2c 100644
--- a/include/dom/dom.h
+++ b/include/dom/dom.h
@@ -85,6 +85,7 @@
#include <dom/html/html_tablecaption_element.h>
#include <dom/html/html_tablecell_element.h>
#include <dom/html/html_tablecol_element.h>
+#include <dom/html/html_tablesection_element.h>
/* DOM Events header */
#include <dom/events/events.h>
diff --git a/include/dom/html/html_tablesection_element.h b/include/dom/html/html_tablesection_element.h
index 2e182d5..e3b0065 100644
--- a/include/dom/html/html_tablesection_element.h
+++ b/include/dom/html/html_tablesection_element.h
@@ -3,5 +3,55 @@
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
+ * Copyright 2014 Rupinder Singh Khokhar <rsk1v_alignr99@gmail.com>
*/
+#ifndef dom_html_table_section_element_h_
+#define dom_html_table_section_element_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+#include <dom/core/string.h>
+
+#include <dom/html/html_collection.h>
+#include <dom/html/html_element.h>
+
+typedef struct dom_html_table_section_element dom_html_table_section_element;
+
+dom_exception dom_html_table_section_element_get_align(
+ dom_html_table_section_element *table_section, dom_string **align);
+
+dom_exception dom_html_table_section_element_set_align(
+ dom_html_table_section_element *table_section, dom_string *align);
+
+dom_exception dom_html_table_section_element_get_ch(
+ dom_html_table_section_element *table_section, dom_string **ch);
+
+dom_exception dom_html_table_section_element_set_ch(
+ dom_html_table_section_element *table_section, dom_string *ch);
+
+dom_exception dom_html_table_section_element_get_ch_off(
+ dom_html_table_section_element *table_section, dom_string **ch_off);
+
+dom_exception dom_html_table_section_element_set_ch_off(
+ dom_html_table_section_element *table_section, dom_string *ch_off);
+
+dom_exception dom_html_table_section_element_get_v_align(
+ dom_html_table_section_element *table_section, dom_string **v_align);
+
+dom_exception dom_html_table_section_element_set_v_align(
+ dom_html_table_section_element *table_section, dom_string *v_align);
+
+dom_exception dom_html_table_section_element_get_rows(
+ dom_html_table_section_element *table_section, dom_html_collection **rows);
+
+dom_exception dom_html_table_section_element_insert_row(
+ dom_html_table_section_element *element,
+ int32_t index, dom_html_element **newRow);
+
+dom_exception dom_html_table_section_element_delete_row(
+ dom_html_table_section_element *element,
+ int32_t index);
+
+#endif
+
diff --git a/src/html/Makefile b/src/html/Makefile
index c66e670..8fc029d 100644
--- a/src/html/Makefile
+++ b/src/html/Makefile
@@ -16,10 +16,10 @@ DIR_SOURCES := \
html_basefont_element.c html_image_element.c html_object_element.c \
html_param_element.c html_applet_element.c html_area_element.c \
html_map_element.c html_script_element.c html_tablecaption_element.c \
- html_tablecell_element.c html_tablecol_element.c
+ html_tablecell_element.c html_tablecol_element.c html_tablesection_element.c
UNINMPLEMENTED_SOURCES := \
- html_table_element.c html_tablesection_element.c \
+ html_table_element.c \
html_tablerow_element.c html_frameset_element.c \
html_frame_element.c html_iframe_element.c
diff --git a/src/html/TODO b/src/html/TODO
index 584de0e..50e905c 100644
--- a/src/html/TODO
+++ b/src/html/TODO
@@ -48,8 +48,8 @@ HTMLAreaElement html_area_element DONE
HTMLScriptElement html_script_element DONE
HTMLTableElement html_table_element MISSING
HTMLTableCaptionElement html_tablecaption_element DONE
-HTMLTableColElement html_tablecol_element MISSING
-HTMLTableSectionElement html_tablesection_element MISSING
+HTMLTableColElement html_tablecol_element DONE
+HTMLTableSectionElement html_tablesection_element DONE
HTMLTableRowElement html_tablerow_element MISSING
HTMLTableCellElement html_tablecell_element DONE
HTMLFrameSetElement html_frameset_element MISSING
diff --git a/src/html/html_document.c b/src/html/html_document.c
index 5aef359..692dd98 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -53,6 +53,7 @@
#include "html/html_tablecaption_element.h"
#include "html/html_tablecell_element.h"
#include "html/html_tablecol_element.h"
+#include "html/html_tablesection_element.h"
#include "core/attr.h"
#include "core/string.h"
@@ -347,6 +348,11 @@ _dom_html_document_create_element_internal(dom_html_document *html,
) {
exc = _dom_html_table_col_element_create(html, tag_name, namespace, prefix,
(dom_html_table_col_element **) result);
+ } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_THEAD])||
+ dom_string_caseless_isequal(tag_name, html->memoised[hds_TBODY])||
+ dom_string_caseless_isequal(tag_name, html->memoised[hds_TBODY])) {
+ exc = _dom_html_table_section_element_create(html, tag_name, namespace, prefix,
+ (dom_html_table_section_element **) result);
} else {
exc = _dom_html_element_create(html, tag_name, namespace,
prefix, result);
diff --git a/src/html/html_tablesection_element.c b/src/html/html_tablesection_element.c
index 2e182d5..7468d01 100644
--- a/src/html/html_tablesection_element.c
+++ b/src/html/html_tablesection_element.c
@@ -3,5 +3,317 @@
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
+ * Copyright 2014 Rupinder Singh Khokhar<rsk1coder99@gmail.com>
*/
+#include <assert.h>
+#include <stdlib.h>
+
+#include <dom/html/html_tablesection_element.h>
+
+#include "html/html_document.h"
+#include "html/html_tablesection_element.h"
+
+#include "html/html_collection.h"
+#include "html/html_element.h"
+
+#include "core/node.h"
+#include "core/attr.h"
+#include "utils/utils.h"
+
+static struct dom_element_protected_vtable _protect_vtable = {
+ {
+ DOM_NODE_PROTECT_VTABLE_HTML_TABLE_SECTION_ELEMENT
+ },
+ DOM_HTML_TABLE_SECTION_ELEMENT_PROTECT_VTABLE
+};
+
+/**
+ * Create a dom_html_table_section_element object
+ *
+ * \table_section doc The document object
+ * \table_section ele The returned element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_html_table_section_element_create(struct dom_html_document *doc,
+ dom_string *tag_name, dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_section_element **ele)
+{
+ struct dom_node_internal *node;
+
+ *ele = malloc(sizeof(dom_html_table_section_element));
+ if (*ele == NULL)
+ return DOM_NO_MEM_ERR;
+
+ /* Set up vtables */
+ node = (struct dom_node_internal *) *ele;
+ node->base.vtable = &_dom_html_element_vtable;
+ node->vtable = &_protect_vtable;
+
+ return _dom_html_table_section_element_initialise(doc, tag_name, namespace, prefix, *ele);
+}
+
+/**
+ * Initialise a dom_html_table_section_element object
+ *
+ * \table_section doc The document object
+ * \table_section ele The dom_html_table_section_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_html_table_section_element_initialise(struct dom_html_document *doc,
+ dom_string *tag_name, dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_section_element *ele)
+{
+ return _dom_html_element_initialise(doc, &ele->base,
+ tag_name,
+ namespace, prefix);
+}
+
+/**
+ * Finalise a dom_html_table_section_element object
+ *
+ * \table_section ele The dom_html_table_section_element object
+ */
+void _dom_html_table_section_element_finalise(struct dom_html_table_section_element *ele)
+{
+ _dom_html_element_finalise(&ele->base);
+}
+
+/**
+ * Destroy a dom_html_table_section_element object
+ *
+ * \table_section ele The dom_html_table_section_element object
+ */
+void _dom_html_table_section_element_destroy(struct dom_html_table_section_element *ele)
+{
+ _dom_html_table_section_element_finalise(ele);
+ free(ele);
+}
+
+/*------------------------------------------------------------------------*/
+/* The protected virtual functions */
+
+/* The virtual function used to parse attribute value, see src/core/element.c
+ * for detail */
+dom_exception _dom_html_table_section_element_parse_attribute(dom_element *ele,
+ dom_string *name, dom_string *value,
+ dom_string **parsed)
+{
+ UNUSED(ele);
+ UNUSED(name);
+
+ dom_string_ref(value);
+ *parsed = value;
+
+ return DOM_NO_ERR;
+}
+
+/* The virtual destroy function, see src/core/node.c for detail */
+void _dom_virtual_html_table_section_element_destroy(dom_node_internal *node)
+{
+ _dom_html_table_section_element_destroy((struct dom_html_table_section_element *) node);
+}
+
+/* The virtual copy function, see src/core/node.c for detail */
+dom_exception _dom_html_table_section_element_copy(dom_node_internal *old,
+ dom_node_internal **copy)
+{
+ return _dom_html_element_copy(old, copy);
+}
+
+/*-----------------------------------------------------------------------*/
+/* API functions */
+
+#define SIMPLE_GET(attr) \
+ dom_exception dom_html_table_section_element_get_##attr( \
+ dom_html_table_section_element *element, \
+ dom_string **attr) \
+{ \
+ dom_exception ret; \
+ dom_string *_memo_##attr; \
+ \
+ _memo_##attr = \
+ ((struct dom_html_document *) \
+ ((struct dom_node_internal *)element)->owner)-> \
+ memoised[hds_##attr]; \
+ \
+ ret = dom_element_get_attribute(element, _memo_##attr, attr); \
+ \
+ return ret; \
+}
+#define SIMPLE_SET(attr) \
+ dom_exception dom_html_table_section_element_set_##attr( \
+ dom_html_table_section_element *element, \
+ dom_string *attr) \
+{ \
+ dom_exception ret; \
+ dom_string *_memo_##attr; \
+ \
+ _memo_##attr = \
+ ((struct dom_html_document *) \
+ ((struct dom_node_internal *)element)->owner)-> \
+ memoised[hds_##attr]; \
+ \
+ ret = dom_element_set_attribute(element, _memo_##attr, attr); \
+ \
+ return ret; \
+}
+
+#define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr)
+SIMPLE_GET_SET(align);
+SIMPLE_GET_SET(ch);
+SIMPLE_GET_SET(ch_off);
+SIMPLE_GET_SET(v_align);
+
+/* The callback function for _dom_html_collection_create*/
+bool table_section_callback(struct dom_node_internal *node, void *ctx)
+{
+ if(node->type == DOM_ELEMENT_NODE &&
+ dom_string_caseless_isequal(node->name,
+ ((dom_html_document *)ctx)->memoised[hds_TR]))
+ {
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Get the rows collection
+ *
+ * \param element The dom_html_section_element object
+ * \param rows The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_section_element_get_rows(
+ dom_html_table_section_element *element,
+ dom_html_collection **rows)
+{
+ dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner;
+ _dom_html_collection_create(doc, (dom_node_internal *)element,
+ table_section_callback, (void *)doc, rows);
+ return DOM_NO_ERR;
+}
+
+/**
+ * Insert Row before the given Index
+ *
+ * \param element The dom_html_section_element object
+ * \param index The Index of the Row node to be inserted
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_section_element_insert_row(
+ dom_html_table_section_element *element,
+ int32_t index, dom_html_element **newRow) {
+ dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner;
+
+ dom_node *node; /*< The node at the (index)th position*/
+
+ dom_html_collection *rows; /*< The collection of rows in input table_section_element*/
+ uint32_t len; /*< The size of the row collection */
+ dom_exception exp; /*< Variable for getting the exceptions*/
+ exp = _dom_html_element_create(doc, doc->memoised[hds_TR],
+ ((dom_node_internal *)element)->namespace,
+ ((dom_node_internal *)element)->prefix,
+ newRow);
+ if(exp != DOM_NO_ERR)
+ return exp;
+
+ exp = dom_html_table_section_element_get_rows(element, &rows);
+ if(exp != DOM_NO_ERR)
+ return exp;
+
+ exp = dom_html_collection_get_length(rows, &len);
+ if(exp != DOM_NO_ERR)
+ return exp;
+
+ if(index < -1 || (uint32_t)index > len) {
+ /* Check for index validity */
+ return DOM_INDEX_SIZE_ERR;
+ } else if((index == -1 || (uint32_t)index == len)
+ &&len != 0) {
+ dom_html_collection_item(rows,
+ len-1, &node);
+
+ dom_node_internal *internal_node = (dom_node_internal *)node; /*< The dom_node_internal row object at the (len-1)th position*/
+
+ ((dom_node_internal *) *newRow)->next = internal_node->next;
+ ((dom_node_internal *) *newRow)->previous = internal_node;
+ internal_node->next = (dom_node_internal *)*newRow;
+ } else if(len != 0) {
+ dom_html_collection_item(rows,
+ index, &node);
+
+ dom_node_internal *internal_node = (dom_node_internal *)node; /*< The dom_node_internal row object at the (index)th position*/
+
+ ((dom_node_internal *) *newRow)->next = internal_node;
+ ((dom_node_internal *) *newRow)->previous = internal_node->previous;
+ if(internal_node->previous != NULL) {
+ (internal_node->previous)->next = (dom_node_internal *)*newRow;
+ internal_node->previous = (dom_node_internal *)*newRow;
+ }
+ }
+
+ /*Adjust parent's pointers*/
+ ((dom_node_internal *) *newRow)->parent = (dom_node_internal *)element;
+ if(index == 0)
+ ((dom_node_internal *)element)->first_child = (dom_node_internal *)*newRow;
+ if((uint32_t)index == len)
+ ((dom_node_internal *)element)->last_child = (dom_node_internal *)*newRow;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Delete Row at given Index
+ *
+ * \param element The dom_html_section_element object
+ * \param index The Index of the Row node to be deleted
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_section_element_delete_row(
+ dom_html_table_section_element *element,
+ int32_t index) {
+ dom_node *node; /*< The node at the (index)th position*/
+
+ dom_html_collection *rows; /*< The collection of rows in input table_section_element*/
+ uint32_t len; /*< The size of the row collection */
+
+ dom_exception exp; /*< Temporary variable to store & check the exceptions*/
+
+ exp = dom_html_table_section_element_get_rows(element, &rows);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+
+ exp = dom_html_collection_get_length(rows, &len);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+
+ if(index < -1 || (uint32_t)index >= len) {
+ /* Check for index validity */
+ return DOM_INDEX_SIZE_ERR;
+ } else if(index == -1) {
+ exp = dom_html_collection_item(rows,
+ len-1, &node);
+ } else {
+ exp = dom_html_collection_item(rows,
+ index, &node);
+ }
+ if(exp != DOM_NO_ERR)
+ return exp;
+
+ dom_node_internal *internal_node = (dom_node_internal *)node;
+
+ /*Fixing the sibling pointers*/
+ if(internal_node->previous != NULL) {
+ (internal_node->previous)->next = internal_node->next;
+ }
+ if(internal_node->next != NULL) {
+ (internal_node->next)->previous = internal_node->previous;
+ }
+
+ _dom_html_element_destroy(internal_node);
+
+ return DOM_NO_ERR;
+}
diff --git a/src/html/html_tablesection_element.h b/src/html/html_tablesection_element.h
index 2e182d5..fcab1cb 100644
--- a/src/html/html_tablesection_element.h
+++ b/src/html/html_tablesection_element.h
@@ -3,5 +3,52 @@
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
+ * Copyright 2014 Rupinder Singh Khokhar <rsk1coder99@gmail.com>
*/
+#ifndef dom_internal_html_table_section_element_h_
+#define dom_internal_html_table_section_element_h_
+
+#include <dom/html/html_tablesection_element.h>
+#include "html/html_element.h"
+
+
+struct dom_html_table_section_element {
+ struct dom_html_element base;
+ /**< The base class */
+};
+
+/* Create a dom_html_table_section_element object */
+dom_exception _dom_html_table_section_element_create(struct dom_html_document *doc,
+ dom_string *tag_name, dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_section_element **ele);
+
+/* Initialise a dom_html_table_section_element object */
+dom_exception _dom_html_table_section_element_initialise(struct dom_html_document *doc,
+ dom_string *tag_name, dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_section_element *ele);
+
+/* Finalise a dom_html_table_section_element object */
+void _dom_html_table_section_element_finalise(struct dom_html_table_section_element *ele);
+
+/* Destroy a dom_html_table_section_element object */
+void _dom_html_table_section_element_destroy(struct dom_html_table_section_element *ele);
+
+/* The protected virtual functions */
+dom_exception _dom_html_table_section_element_parse_attribute(dom_element *ele,
+ dom_string *name, dom_string *value,
+ dom_string **parsed);
+void _dom_virtual_html_table_section_element_destroy(dom_node_internal *node);
+dom_exception _dom_html_table_section_element_copy(dom_node_internal *old,
+ dom_node_internal **copy);
+
+#define DOM_HTML_TABLE_SECTION_ELEMENT_PROTECT_VTABLE \
+ _dom_html_table_section_element_parse_attribute
+
+#define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_SECTION_ELEMENT \
+ _dom_virtual_html_table_section_element_destroy, \
+ _dom_html_table_section_element_copy
+
+#endif
+bool table_section_callback(struct dom_node_internal *node, void *ctx);
+
diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm
index 6dfaae9..78d5e7e 100644
--- a/test/DOMTSHandler.pm
+++ b/test/DOMTSHandler.pm
@@ -43,6 +43,7 @@ our %special_type = (
CharacterData => "dom_characterdata *",
CDATASection => "dom_cdata_section *",
HTMLAnchorElement => "dom_html_anchor_element *",
+ HTMLElement => "dom_html_element *",
);
our %special_prefix = (
DOMString => "dom_string",
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement01.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement01.xml
index 238dcb2..238dcb2 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement01.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement01.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement02.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement02.xml
index c4bdbf9..c4bdbf9 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement02.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement02.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement03.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement03.xml
index 2236435..2236435 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement03.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement03.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement04.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement04.xml
index 2060f35..2060f35 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement04.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement04.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement05.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement05.xml
index 32022bb..32022bb 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement05.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement05.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement06.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement06.xml
index be665e4..be665e4 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement06.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement06.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement07.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement07.xml
index ecf38f3..ecf38f3 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement07.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement07.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement08.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement08.xml
index 48440ca..48440ca 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement08.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement08.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement09.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement09.xml
index 501446b..501446b 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement09.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement09.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement10.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement10.xml
index 3e011c1..3e011c1 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement10.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement10.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement11.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement11.xml
index ba5ae68..ba5ae68 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement11.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement11.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableSectionElement12.xml.kfail b/test/testcases/tests/level1/html/HTMLTableSectionElement12.xml
index e649489..e649489 100644
--- a/test/testcases/tests/level1/html/HTMLTableSectionElement12.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableSectionElement12.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableSectionElement25.xml.kfail b/test/testcases/tests/level2/html/HTMLTableSectionElement25.xml
index 8fbd1c2..8fbd1c2 100644
--- a/test/testcases/tests/level2/html/HTMLTableSectionElement25.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableSectionElement25.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableSectionElement26.xml.kfail b/test/testcases/tests/level2/html/HTMLTableSectionElement26.xml
index 206d91f..206d91f 100644
--- a/test/testcases/tests/level2/html/HTMLTableSectionElement26.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableSectionElement26.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableSectionElement27.xml.kfail b/test/testcases/tests/level2/html/HTMLTableSectionElement27.xml
index 3ab35a5..3ab35a5 100644
--- a/test/testcases/tests/level2/html/HTMLTableSectionElement27.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableSectionElement27.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableSectionElement28.xml.kfail b/test/testcases/tests/level2/html/HTMLTableSectionElement28.xml
index 5578ba5..5578ba5 100644
--- a/test/testcases/tests/level2/html/HTMLTableSectionElement28.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableSectionElement28.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableSectionElement29.xml.kfail b/test/testcases/tests/level2/html/HTMLTableSectionElement29.xml
index 0ddd852..0ddd852 100644
--- a/test/testcases/tests/level2/html/HTMLTableSectionElement29.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableSectionElement29.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableSectionElement30.xml.kfail b/test/testcases/tests/level2/html/HTMLTableSectionElement30.xml.kfail
deleted file mode 100644
index 8fd17c2..0000000
--- a/test/testcases/tests/level2/html/HTMLTableSectionElement30.xml.kfail
+++ b/dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
--->
-<!DOCTYPE test SYSTEM "dom2.dtd">
-<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2" name="HTMLTableSectionElement30">
-<metadata>
-<title>HTMLTableSectionElement30</title>
-<creator>NIST</creator>
-<description>
- The insertRow() method inserts a new empty table row. The new
- row is inserted immediately before the current indexth row in this
- section. If index is -1 or equal to the number of rows in this section,
- the new row is appended.
-
- Retrieve the first THEAD element and invoke the insertRow() method
- with an index of negative one. Since the index is negative one the
- new row is appended.
- After the new row is appended the number of rows in the THEAD
- section is two.
-</description>
-<contributor>Rick Rivello</contributor>
-<date qualifier="created">2002-11-07</date>
-<subject resource="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-93995626"/>
-</metadata>
-<var name="nodeList" type="NodeList"/>
-<var name="testNode" type="Node"/>
-<var name="newRow" type="HTMLElement"/>
-<var name="rowsnodeList" type="HTMLCollection"/>
-<var name="vrows" type="int"/>
-<var name="doc" type="Document"/>
-<load var="doc" href="tablesection" willBeModified="true"/>
-<getElementsByTagName interface="Document" obj="doc" var="nodeList" tagname="&quot;thead&quot;"/>
-<assertSize collection="nodeList" size="1" id="Asize"/>
-<item interface="NodeList" obj="nodeList" var="testNode" index="0"/>
-<rows interface="HTMLTableSectionElement" obj="testNode" var="rowsnodeList"/>
-<length interface="HTMLCollection" obj="rowsnodeList" var="vrows"/>
-<assertEquals actual="vrows" expected="1" id="rowsLink1" ignoreCase="false"/>
-<insertRow interface="HTMLTableSectionElement" obj="testNode" var="newRow" index="-1"/>
-<rows interface="HTMLTableSectionElement" obj="testNode" var="rowsnodeList"/>
-<length interface="HTMLCollection" obj="rowsnodeList" var="vrows"/>
-<assertEquals actual="vrows" expected="2" id="rowsLink2" ignoreCase="false"/>
-</test>
diff --git a/test/testcases/tests/level2/html/HTMLTableSectionElement31.xml.kfail b/test/testcases/tests/level2/html/HTMLTableSectionElement31.xml.kfail
deleted file mode 100644
index 55464e2..0000000
--- a/test/testcases/tests/level2/html/HTMLTableSectionElement31.xml.kfail
+++ b/dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
--->
-<!DOCTYPE test SYSTEM "dom2.dtd">
-<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2" name="HTMLTableSectionElement31">
-<metadata>
-<title>HTMLTableSectionElement31</title>
-<creator>NIST</creator>
-<description>
- The deleteRow() method deletes a row from this section. The index
- starts from 0 and is relative only to the rows contained inside
- this section, not all the rows in the table. If the index is -1
- the last row will be deleted.
-
- Retrieve the second TBODY element and invoke the deleteRow() method
- with an index of -1. The nuber of rows in the THEAD section before
- the deletion of the row is two. After the row is deleted the number
- of rows in the TBODY section is one.
-</description>
-<contributor>Rick Rivello</contributor>
-<date qualifier="created">2002-11-07</date>
-<subject resource="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-5625626"/>
-</metadata>
-<var name="nodeList" type="NodeList"/>
-<var name="testNode" type="Node"/>
-<var name="rowsnodeList" type="HTMLCollection"/>
-<var name="vrows" type="int"/>
-<var name="doc" type="Document"/>
-<load var="doc" href="tablesection" willBeModified="true"/>
-<getElementsByTagName interface="Document" obj="doc" var="nodeList" tagname="&quot;tbody&quot;"/>
-<assertSize collection="nodeList" size="2" id="Asize"/>
-<item interface="NodeList" obj="nodeList" var="testNode" index="1"/>
-<rows interface="HTMLTableSectionElement" obj="testNode" var="rowsnodeList"/>
-<length interface="HTMLCollection" obj="rowsnodeList" var="vrows"/>
-<assertEquals actual="vrows" expected="2" id="rowsLink1" ignoreCase="false"/>
-<deleteRow interface="HTMLTableSectionElement" obj="testNode" index="-1"/>
-<rows interface="HTMLTableSectionElement" obj="testNode" var="rowsnodeList"/>
-<length interface="HTMLCollection" obj="rowsnodeList" var="vrows"/>
-<assertEquals actual="vrows" expected="1" id="rowsLink2" ignoreCase="false"/>
-</test>
diff --git a/test/testcases/tests/level2/html/files/tablesection.html b/test/testcases/tests/level2/html/files/tablesection.html
new file mode 100644
index 0000000..0c1a5f7
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/tablesection.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
+<TITLE>NIST DOM HTML Test - TABLESECTION</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE ALIGN="center" SUMMARY="Table 1">
+<TBODY>
+<TR>
+<TH>Id</TH>
+<TH>Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+</TBODY>
+</TABLE>
+<TABLE ID="table-1" ALIGN="center" BORDER="4" BGCOLOR="#ff0000" FRAME="border" CELLPADDING="2" CELLSPACING="2" SUMMARY="HTML Control Table" RULES="all" WIDTH="680">
+<CAPTION ALIGN="top">Table Caption</CAPTION>
+<THEAD ALIGN="center" VALIGN="middle" CHAR="*" CHAROFF="1">
+<TR ALIGN="center" BGCOLOR="#00FFFF" VALIGN="middle" CHAR="*" CHAROFF="1">
+<TH ID="header-1">Employee Id</TH>
+<TH ID="header-2" ABBR="maiden" AXIS="center" ALIGN="center" BGCOLOR="#00FFFF" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-1" VALIGN="middle" WIDTH="100">Employee Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+<TH>Gender</TH>
+<TH>Address</TH>
+</TR>
+</THEAD>
+<TFOOT ALIGN="center" VALIGN="middle" CHAR="+" CHAROFF="2">
+<TR>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+<TH>next page ...</TH>
+</TR>
+</TFOOT>
+<TBODY ALIGN="center" VALIGN="middle" CHAR="$" CHAROFF="3">
+<TR>
+<TD AXIS="center" ID="Table-3" ABBR="maiden2" ALIGN="center" BGCOLOR="#FF0000" COLSPAN="1" HEIGHT="50" NOWRAP="nowrap" ROWSPAN="1" SCOPE="col" HEADERS="header-2" VALIGN="middle" WIDTH="175">EMP0001</TD>
+<TD HEADERS="header-2">Margaret Martin</TD>
+<TD>Accountant</TD>
+<TD>56,000</TD>
+<TD>Female</TD>
+<TD>1230 North Ave. Dallas, Texas 98551</TD>
+</TR>
+<TR>
+<TD>EMP0002</TD>
+<TD>Martha Raynolds</TD>
+<TD>Secretary</TD>
+<TD>35,000</TD>
+<TD>Female</TD>
+<TD>1900 Dallas Road Dallas, Texas 98554</TD>
+</TR>
+</TBODY>
+</TABLE>
+</BODY>
+</HTML>
+
+
diff --git a/test/testcases/tests/level2/html/files/tablesection.xhtml b/test/testcases/tests/level2/html/files/tablesection.xhtml
new file mode 100644
index 0000000..3498650
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/tablesection.xhtml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLESECTION</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tbody>
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</tbody>
+</table>
+<table id="table-1" align="center" border="4" bgcolor="#ff0000" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all" width="680">
+<caption align="top">Table Caption</caption>
+<thead align="center" valign="middle" char="*" charoff="1">
+<tr align="center" bgcolor="#00FFFF" valign="middle" char="*" charoff="1">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" bgcolor="#00FFFF" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="100">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle" char="+" charoff="2">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle" char="$" charoff="3">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" align="center" bgcolor="#FF0000" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-2" valign="middle" width="175">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
+
+
diff --git a/test/testcases/tests/level2/html/files/tablesection.xml b/test/testcases/tests/level2/html/files/tablesection.xml
new file mode 100644
index 0000000..3498650
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/tablesection.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "xhtml1-transitional.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+<title>NIST DOM HTML Test - TABLESECTION</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tbody>
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</tbody>
+</table>
+<table id="table-1" align="center" border="4" bgcolor="#ff0000" frame="border" cellpadding="2" cellspacing="2" summary="HTML Control Table" rules="all" width="680">
+<caption align="top">Table Caption</caption>
+<thead align="center" valign="middle" char="*" charoff="1">
+<tr align="center" bgcolor="#00FFFF" valign="middle" char="*" charoff="1">
+<th id="header-1">Employee Id</th>
+<th id="header-2" abbr="maiden" axis="center" align="center" bgcolor="#00FFFF" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-1" valign="middle" width="100">Employee Name</th>
+<th>Position</th>
+<th>Salary</th>
+<th>Gender</th>
+<th>Address</th>
+</tr>
+</thead>
+<tfoot align="center" valign="middle" char="+" charoff="2">
+<tr>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+<th>next page ...</th>
+</tr>
+</tfoot>
+<tbody align="center" valign="middle" char="$" charoff="3">
+<tr>
+<td axis="center" id="Table-3" abbr="maiden2" align="center" bgcolor="#FF0000" colspan="1" height="50" nowrap="nowrap" rowspan="1" scope="col" headers="header-2" valign="middle" width="175">EMP0001</td>
+<td headers="header-2">Margaret Martin</td>
+<td>Accountant</td>
+<td>56,000</td>
+<td>Female</td>
+<td>1230 North Ave. Dallas, Texas 98551</td>
+</tr>
+<tr>
+<td>EMP0002</td>
+<td>Martha Raynolds</td>
+<td>Secretary</td>
+<td>35,000</td>
+<td>Female</td>
+<td>1900 Dallas Road Dallas, Texas 98554</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
+
+