summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsk1994 <rsk1coder99@gmail.com>2014-05-31 03:37:42 (GMT)
committer Rupinder Singh Khokhar <rsk1coder99@gmail.com>2014-06-10 22:57:11 (GMT)
commitf0a3c95cfc4a5595f930cd5dd14d6cbbf1f85312 (patch)
tree5f74ee26934ca2c29dcf9b61061c035ff5dce801
parentca30ba7de4c3b0b17a61e1f07032575a01f2cd25 (diff)
downloadlibdom-f0a3c95cfc4a5595f930cd5dd14d6cbbf1f85312.tar.gz
libdom-f0a3c95cfc4a5595f930cd5dd14d6cbbf1f85312.tar.bz2
tableSectionElement Rev.2 && tableCellElement Rev.4 && tableElement Rev.1 && tableRowElement Rev.1 && DOMTSHandler(Test Suite) Revised and implemented inefficient ways to produce correct .c's && other minor bg fixes in HTMLCollection... Tests expecting 2nd attribute of dom_html_collection_get_length to be of type int32_t aren't enabled yet. Will be done in a later commit.
-rw-r--r--Makefile2
-rw-r--r--include/dom/dom.h2
-rw-r--r--include/dom/html/html_table_element.h123
-rw-r--r--include/dom/html/html_tablerow_element.h62
-rw-r--r--include/dom/html/html_tablesection_element.h4
-rw-r--r--src/html/Makefile6
-rw-r--r--src/html/TODO4
-rw-r--r--src/html/html_collection.c2
-rw-r--r--src/html/html_document.c10
-rw-r--r--src/html/html_document_strings.h5
-rw-r--r--src/html/html_table_element.c740
-rw-r--r--src/html/html_table_element.h56
-rw-r--r--src/html/html_tablecell_element.c19
-rw-r--r--src/html/html_tablerow_element.c368
-rw-r--r--src/html/html_tablerow_element.h46
-rw-r--r--src/html/html_tablesection_element.c77
-rw-r--r--src/html/html_tablesection_element.h2
-rw-r--r--test/DOMTSHandler.pm91
-rw-r--r--test/testcases/tests/level1/html/HTMLCollection04.xml.kfail (copied from test/testcases/tests/level1/html/HTMLCollection01.xml.notimpl)36
-rw-r--r--test/testcases/tests/level1/html/HTMLCollection05.xml.kfail (renamed from test/testcases/tests/level1/html/HTMLCollection02.xml.kfail)29
-rw-r--r--test/testcases/tests/level1/html/HTMLCollection09.xml.kfail (renamed from test/testcases/tests/level1/html/HTMLCollection01.xml.notimpl)16
-rw-r--r--test/testcases/tests/level1/html/HTMLCollection12.xml.kfail (renamed from test/testcases/tests/level1/html/HTMLCollection03.xml.kfail)21
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement01.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement01.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement02.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement02.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement03.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement03.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement04.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement04.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement05.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement05.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement06.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement06.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement07.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement07.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement08.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement08.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement09.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement09.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement10.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement10.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement11.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement11.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement12.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement12.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement13.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement13.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement14.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement14.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement15.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement15.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement16.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement16.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement17.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement17.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement18.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement18.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement19.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement19.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement20.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement20.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement21.xml.kfail4
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement22.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement22.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement23.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement23.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement24.xml.kfail4
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement25.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement25.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement26.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement26.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableElement27.xml (renamed from test/testcases/tests/level1/html/HTMLTableElement27.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement01.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement01.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement02.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement02.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement03.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement03.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement04.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement04.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement06.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement06.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement07.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement07.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement08.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement08.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement09.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement09.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLTableRowElement10.xml (renamed from test/testcases/tests/level1/html/HTMLTableRowElement10.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/anchor01.xml (renamed from test/testcases/tests/level1/html/anchor01.xml.notimpl)0
-rw-r--r--test/testcases/tests/level1/html/anchor02.xml (renamed from test/testcases/tests/level1/html/anchor02.xml.notimpl)0
-rw-r--r--test/testcases/tests/level1/html/anchor03.xml (renamed from test/testcases/tests/level1/html/anchor03.xml.notimpl)0
-rw-r--r--test/testcases/tests/level1/html/anchor04.xml.kfail (renamed from test/testcases/tests/level1/html/anchor04.xml.notimpl)0
-rw-r--r--test/testcases/tests/level1/html/anchor05.xml (renamed from test/testcases/tests/level1/html/anchor05.xml.notimpl)0
-rw-r--r--test/testcases/tests/level1/html/anchor06.xml (renamed from test/testcases/tests/level1/html/anchor06.xml.notimpl)0
-rw-r--r--test/testcases/tests/level1/html/dlist01.xml (renamed from test/testcases/tests/level1/html/dlist01.xml.notimpl)0
-rw-r--r--test/testcases/tests/level1/html/table01.xml (renamed from test/testcases/tests/level1/html/table01.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table02.xml (renamed from test/testcases/tests/level1/html/table02.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table03.xml (renamed from test/testcases/tests/level1/html/table03.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table04.xml (renamed from test/testcases/tests/level1/html/table04.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table08.xml (renamed from test/testcases/tests/level1/html/table08.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table09.xml (renamed from test/testcases/tests/level1/html/table09.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table10.xml (renamed from test/testcases/tests/level1/html/table10.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table12.xml (renamed from test/testcases/tests/level1/html/table12.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table17.xml (renamed from test/testcases/tests/level1/html/table17.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table18.xml (renamed from test/testcases/tests/level1/html/table18.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table19.xml (renamed from test/testcases/tests/level1/html/table19.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table20.xml (renamed from test/testcases/tests/level1/html/table20.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table21.xml (renamed from test/testcases/tests/level1/html/table21.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table22.xml (renamed from test/testcases/tests/level1/html/table22.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table23.xml (renamed from test/testcases/tests/level1/html/table23.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table24.xml (renamed from test/testcases/tests/level1/html/table24.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table25.xml (renamed from test/testcases/tests/level1/html/table25.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table26.xml (renamed from test/testcases/tests/level1/html/table26.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table27.xml (renamed from test/testcases/tests/level1/html/table27.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table28.xml (renamed from test/testcases/tests/level1/html/table28.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table29.xml (renamed from test/testcases/tests/level1/html/table29.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table30.xml (renamed from test/testcases/tests/level1/html/table30.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table31.xml (renamed from test/testcases/tests/level1/html/table31.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table32.xml (renamed from test/testcases/tests/level1/html/table32.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table33.xml (renamed from test/testcases/tests/level1/html/table33.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table34.xml (renamed from test/testcases/tests/level1/html/table34.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table35.xml (renamed from test/testcases/tests/level1/html/table35.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table36.xml (renamed from test/testcases/tests/level1/html/table36.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table37.xml (renamed from test/testcases/tests/level1/html/table37.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table38.xml (renamed from test/testcases/tests/level1/html/table38.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table39.xml (renamed from test/testcases/tests/level1/html/table39.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table40.xml (renamed from test/testcases/tests/level1/html/table40.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table41.xml (renamed from test/testcases/tests/level1/html/table41.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table42.xml (renamed from test/testcases/tests/level1/html/table42.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table43.xml (renamed from test/testcases/tests/level1/html/table43.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table44.xml (renamed from test/testcases/tests/level1/html/table44.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table45.xml (renamed from test/testcases/tests/level1/html/table45.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table46.xml (renamed from test/testcases/tests/level1/html/table46.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table47.xml (renamed from test/testcases/tests/level1/html/table47.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table48.xml (renamed from test/testcases/tests/level1/html/table48.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table49.xml (renamed from test/testcases/tests/level1/html/table49.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table50.xml (renamed from test/testcases/tests/level1/html/table50.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table51.xml (renamed from test/testcases/tests/level1/html/table51.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table52.xml (renamed from test/testcases/tests/level1/html/table52.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/table53.xml (renamed from test/testcases/tests/level1/html/table53.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableElement34.xml (renamed from test/testcases/tests/level2/html/HTMLTableElement34.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableElement35.xml (renamed from test/testcases/tests/level2/html/HTMLTableElement35.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableElement36.xml (renamed from test/testcases/tests/level2/html/HTMLTableElement36.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableElement37.xml (renamed from test/testcases/tests/level2/html/HTMLTableElement37.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableElement38.xml (renamed from test/testcases/tests/level2/html/HTMLTableElement38.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableElement39.xml.kfail5
-rw-r--r--test/testcases/tests/level2/html/HTMLTableRowElement15.xml (renamed from test/testcases/tests/level2/html/HTMLTableRowElement15.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableRowElement16.xml (renamed from test/testcases/tests/level2/html/HTMLTableRowElement16.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableRowElement17.xml (renamed from test/testcases/tests/level2/html/HTMLTableRowElement17.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableRowElement18.xml (renamed from test/testcases/tests/level2/html/HTMLTableRowElement18.xml.kfail)0
-rw-r--r--test/testcases/tests/level2/html/HTMLTableRowElement19.xml (renamed from test/testcases/tests/level2/html/HTMLTableRowElement19.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/table.html78
-rw-r--r--test/testcases/tests/level2/html/files/table.xhtml81
-rw-r--r--test/testcases/tests/level2/html/files/table.xml81
-rw-r--r--test/testcases/tests/level2/html/files/table1.html12
-rw-r--r--test/testcases/tests/level2/html/files/table1.xhtml15
-rw-r--r--test/testcases/tests/level2/html/files/table1.xml15
-rw-r--r--test/testcases/tests/level2/html/files/tablerow.html59
-rw-r--r--test/testcases/tests/level2/html/files/tablerow.xhtml62
-rw-r--r--test/testcases/tests/level2/html/files/tablerow.xml62
-rw-r--r--test/testutils/domtsasserts.c4
133 files changed, 2174 insertions, 137 deletions
diff --git a/Makefile b/Makefile
index 0745e10..adb8d59 100644
--- a/Makefile
+++ b/Makefile
@@ -127,6 +127,8 @@ 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) $(I):$(Is)/html_table_element.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablerow_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 071ca2c..fb39388 100644
--- a/include/dom/dom.h
+++ b/include/dom/dom.h
@@ -86,6 +86,8 @@
#include <dom/html/html_tablecell_element.h>
#include <dom/html/html_tablecol_element.h>
#include <dom/html/html_tablesection_element.h>
+#include <dom/html/html_table_element.h>
+#include <dom/html/html_tablerow_element.h>
/* DOM Events header */
#include <dom/events/events.h>
diff --git a/include/dom/html/html_table_element.h b/include/dom/html/html_table_element.h
index 2e182d5..6fcd7ed 100644
--- a/include/dom/html/html_table_element.h
+++ b/include/dom/html/html_table_element.h
@@ -3,5 +3,128 @@
* 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_html_table_element_h_
+#define dom_html_table_element_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+#include <dom/core/string.h>
+
+#include<dom/html/html_element.h>
+#include<dom/html/html_tablecaption_element.h>
+#include<dom/html/html_tablesection_element.h>
+#include<dom/html/html_tablerow_element.h>
+
+typedef struct dom_html_table_element dom_html_table_element;
+
+dom_exception dom_html_table_element_get_caption(
+ dom_html_table_element *element, dom_html_table_caption_element **caption);
+
+dom_exception dom_html_table_element_set_caption(
+ dom_html_table_element *element, dom_html_table_caption_element *caption);
+
+dom_exception dom_html_table_element_get_t_head(
+ dom_html_table_element *element, dom_html_table_section_element **t_head);
+
+dom_exception dom_html_table_element_set_t_head(
+ dom_html_table_element *element, dom_html_table_section_element *t_head);
+
+dom_exception dom_html_table_element_get_t_foot(
+ dom_html_table_element *element, dom_html_table_section_element **t_foot);
+
+dom_exception dom_html_table_element_set_t_foot(
+ dom_html_table_element *element, dom_html_table_section_element *t_foot);
+
+dom_exception dom_html_table_element_get_rows(
+ dom_html_table_element *element, dom_html_collection **rows);
+
+dom_exception dom_html_table_element_get_t_bodies(
+ dom_html_table_element *element, dom_html_collection **t_bodies);
+
+dom_exception dom_html_table_element_get_align(
+ dom_html_table_element *table, dom_string **align);
+
+dom_exception dom_html_table_element_set_align(
+ dom_html_table_element *table, dom_string *align);
+
+dom_exception dom_html_table_element_get_bg_color(
+ dom_html_table_element *table, dom_string **bg_color);
+
+dom_exception dom_html_table_element_set_bg_color(
+ dom_html_table_element *table, dom_string *bg_color);
+
+dom_exception dom_html_table_element_get_border(
+ dom_html_table_element *table, dom_string **border);
+
+dom_exception dom_html_table_element_set_border(
+ dom_html_table_element *table, dom_string *border);
+
+dom_exception dom_html_table_element_get_cell_padding(
+ dom_html_table_element *table, dom_string **cell_padding);
+
+dom_exception dom_html_table_element_set_cell_padding(
+ dom_html_table_element *table, dom_string *cell_padding);
+
+dom_exception dom_html_table_element_get_cell_spacing(
+ dom_html_table_element *table, dom_string **cell_spacing);
+
+dom_exception dom_html_table_element_set_cell_spacing(
+ dom_html_table_element *table, dom_string *cell_spacing);
+
+dom_exception dom_html_table_element_get_frame(
+ dom_html_table_element *table, dom_string **frame);
+
+dom_exception dom_html_table_element_set_frame(
+ dom_html_table_element *table, dom_string *frame);
+
+dom_exception dom_html_table_element_get_rules(
+ dom_html_table_element *table, dom_string **rules);
+
+dom_exception dom_html_table_element_set_rules(
+ dom_html_table_element *table, dom_string *rules);
+
+dom_exception dom_html_table_element_get_summary(
+ dom_html_table_element *table, dom_string **summary);
+
+dom_exception dom_html_table_element_set_summary(
+ dom_html_table_element *table, dom_string *summary);
+
+dom_exception dom_html_table_element_get_width(
+ dom_html_table_element *table, dom_string **width);
+
+dom_exception dom_html_table_element_set_width(
+ dom_html_table_element *table, dom_string *width);
+
+dom_exception dom_html_table_element_create_caption(
+ dom_html_table_element *element,
+ dom_html_element **caption);
+
+dom_exception dom_html_table_element_delete_caption(
+ dom_html_table_element *element);
+
+dom_exception dom_html_table_element_create_t_head(
+ dom_html_table_element *element,
+ dom_html_element **t_head);
+
+dom_exception dom_html_table_element_delete_t_head(
+ dom_html_table_element *element);
+
+dom_exception dom_html_table_element_create_t_foot(
+ dom_html_table_element *element,
+ dom_html_element **t_foot);
+
+dom_exception dom_html_table_element_delete_t_foot(
+ dom_html_table_element *element);
+
+dom_exception dom_html_table_element_insert_row(
+ dom_html_table_element *element,
+ int32_t index, dom_html_element **row);
+
+dom_exception dom_html_table_element_delete_row(
+ dom_html_table_element *element,
+ int32_t index);
+
+#endif
diff --git a/include/dom/html/html_tablerow_element.h b/include/dom/html/html_tablerow_element.h
index 2e182d5..897e243 100644
--- a/include/dom/html/html_tablerow_element.h
+++ b/include/dom/html/html_tablerow_element.h
@@ -3,5 +3,67 @@
* 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_html_table_row_element_h_
+#define dom_html_table_row_element_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+#include <dom/core/string.h>
+
+#include<dom/html/html_element.h>
+#include<dom/html/html_collection.h>
+
+typedef struct dom_html_table_row_element dom_html_table_row_element;
+
+dom_exception dom_html_table_row_element_get_align(
+ dom_html_table_row_element *table, dom_string **align);
+
+dom_exception dom_html_table_row_element_set_align(
+ dom_html_table_row_element *table, dom_string *align);
+
+dom_exception dom_html_table_row_element_get_bg_color(
+ dom_html_table_row_element *table, dom_string **bg_color);
+
+dom_exception dom_html_table_row_element_set_bg_color(
+ dom_html_table_row_element *table, dom_string *bg_color);
+
+dom_exception dom_html_table_row_element_get_ch(
+ dom_html_table_row_element *table, dom_string **ch);
+
+dom_exception dom_html_table_row_element_set_ch(
+ dom_html_table_row_element *table, dom_string *ch);
+
+dom_exception dom_html_table_row_element_get_ch_off(
+ dom_html_table_row_element *table, dom_string **ch_off);
+
+dom_exception dom_html_table_row_element_set_ch_off(
+ dom_html_table_row_element *table, dom_string *ch_off);
+
+dom_exception dom_html_table_row_element_get_v_align(
+ dom_html_table_row_element *table, dom_string **v_align);
+
+dom_exception dom_html_table_row_element_set_v_align(
+ dom_html_table_row_element *table, dom_string *v_align);
+
+dom_exception dom_html_table_row_element_get_row_index(
+ dom_html_table_row_element *table, int32_t *index);
+
+dom_exception dom_html_table_row_element_get_section_row_index(
+ dom_html_table_row_element *table_row, int32_t *section_row_index);
+
+dom_exception dom_html_table_row_element_get_cells(
+ dom_html_table_row_element *element,
+ dom_html_collection **cells);
+
+dom_exception dom_html_table_row_element_delete_cell(
+ dom_html_table_row_element *element,
+ int32_t index);
+
+dom_exception dom_html_table_row_element_insert_cell(
+ dom_html_table_row_element *element,
+ int32_t index, dom_html_element **cell);
+
+#endif
diff --git a/include/dom/html/html_tablesection_element.h b/include/dom/html/html_tablesection_element.h
index e3b0065..bceec18 100644
--- a/include/dom/html/html_tablesection_element.h
+++ b/include/dom/html/html_tablesection_element.h
@@ -16,6 +16,8 @@
#include <dom/html/html_collection.h>
#include <dom/html/html_element.h>
+#include <dom/html/html_tablerow_element.h>
+
typedef struct dom_html_table_section_element dom_html_table_section_element;
dom_exception dom_html_table_section_element_get_align(
@@ -47,7 +49,7 @@ dom_exception dom_html_table_section_element_get_rows(
dom_exception dom_html_table_section_element_insert_row(
dom_html_table_section_element *element,
- int32_t index, dom_html_element **newRow);
+ int32_t index, dom_html_element **new_row);
dom_exception dom_html_table_section_element_delete_row(
dom_html_table_section_element *element,
diff --git a/src/html/Makefile b/src/html/Makefile
index 8fc029d..8c20362 100644
--- a/src/html/Makefile
+++ b/src/html/Makefile
@@ -16,11 +16,11 @@ 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_tablesection_element.c
+ html_tablecell_element.c html_tablecol_element.c html_tablesection_element.c \
+ html_table_element.c html_tablerow_element.c
UNINMPLEMENTED_SOURCES := \
- html_table_element.c \
- html_tablerow_element.c html_frameset_element.c \
+ html_frameset_element.c \
html_frame_element.c html_iframe_element.c
include $(NSBUILD)/Makefile.subdir
diff --git a/src/html/TODO b/src/html/TODO
index 50e905c..0a75535 100644
--- a/src/html/TODO
+++ b/src/html/TODO
@@ -46,11 +46,11 @@ HTMLAppletElement html_applet_element DONE
HTMLMapElement html_map_element DONE
HTMLAreaElement html_area_element DONE
HTMLScriptElement html_script_element DONE
-HTMLTableElement html_table_element MISSING
+HTMLTableElement html_table_element DONE
HTMLTableCaptionElement html_tablecaption_element DONE
HTMLTableColElement html_tablecol_element DONE
HTMLTableSectionElement html_tablesection_element DONE
-HTMLTableRowElement html_tablerow_element MISSING
+HTMLTableRowElement html_tablerow_element DONE
HTMLTableCellElement html_tablecell_element DONE
HTMLFrameSetElement html_frameset_element MISSING
HTMLFrameElement html_frame_element MISSING
diff --git a/src/html/html_collection.c b/src/html/html_collection.c
index fb801d9..2b4d8aa 100644
--- a/src/html/html_collection.c
+++ b/src/html/html_collection.c
@@ -132,7 +132,7 @@ dom_exception dom_html_collection_get_length(dom_html_collection *col,
/* No children and siblings */
struct dom_node_internal *parent = node->parent;
- while (parent != col->root &&
+ while (node != col->root &&
node == parent->last_child) {
node = parent;
parent = parent->parent;
diff --git a/src/html/html_document.c b/src/html/html_document.c
index 692dd98..25abca3 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -54,6 +54,8 @@
#include "html/html_tablecell_element.h"
#include "html/html_tablecol_element.h"
#include "html/html_tablesection_element.h"
+#include "html/html_table_element.h"
+#include "html/html_tablerow_element.h"
#include "core/attr.h"
#include "core/string.h"
@@ -350,9 +352,15 @@ _dom_html_document_create_element_internal(dom_html_document *html,
(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])) {
+ dom_string_caseless_isequal(tag_name, html->memoised[hds_TFOOT])) {
exc = _dom_html_table_section_element_create(html, tag_name, namespace, prefix,
(dom_html_table_section_element **) result);
+ } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TABLE])) {
+ exc = _dom_html_table_element_create(html, namespace, prefix,
+ (dom_html_table_element **) result);
+ } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TD])) {
+ exc = _dom_html_table_row_element_create(html, namespace, prefix,
+ (dom_html_table_row_element **) result);
} else {
exc = _dom_html_element_create(html, tag_name, namespace,
prefix, result);
diff --git a/src/html/html_document_strings.h b/src/html/html_document_strings.h
index 38b0004..8ded892 100644
--- a/src/html/html_document_strings.h
+++ b/src/html/html_document_strings.h
@@ -102,6 +102,9 @@ HTML_DOCUMENT_STRINGS_ACTION1(abbr)
HTML_DOCUMENT_STRINGS_ACTION1(axis)
HTML_DOCUMENT_STRINGS_ACTION1(headers)
HTML_DOCUMENT_STRINGS_ACTION1(scope)
+HTML_DOCUMENT_STRINGS_ACTION1(frame)
+HTML_DOCUMENT_STRINGS_ACTION1(rules)
+HTML_DOCUMENT_STRINGS_ACTION1(summary)
HTML_DOCUMENT_STRINGS_ACTION(tab_index,tabindex)
HTML_DOCUMENT_STRINGS_ACTION(html_for,for)
HTML_DOCUMENT_STRINGS_ACTION(date_time,datetime)
@@ -112,6 +115,8 @@ HTML_DOCUMENT_STRINGS_ACTION(value_type,valuetype)
HTML_DOCUMENT_STRINGS_ACTION(v_align,valign)
HTML_DOCUMENT_STRINGS_ACTION(ch,char)
HTML_DOCUMENT_STRINGS_ACTION(ch_off,charoff)
+HTML_DOCUMENT_STRINGS_ACTION(cell_padding,cellpadding)
+HTML_DOCUMENT_STRINGS_ACTION(cell_spacing,cellspacing)
/* HTML_DOCUMENT_STRINGS_ACTION1(type) */
HTML_DOCUMENT_STRINGS_ACTION(use_map,usemap)
/* HTML_DOCUMENT_STRINGS_ACTION1(value) */
diff --git a/src/html/html_table_element.c b/src/html/html_table_element.c
index 2e182d5..0f27fd3 100644
--- a/src/html/html_table_element.c
+++ b/src/html/html_table_element.c
@@ -3,5 +3,745 @@
* 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_table_element.h>
+
+#include "html/html_document.h"
+#include "html/html_table_element.h"
+#include "html/html_tablecaption_element.h"
+#include "html/html_tablesection_element.h"
+#include "html/html_tablerow_element.h"
+#include "html/html_collection.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_ELEMENT
+ },
+ DOM_HTML_TABLE_ELEMENT_PROTECT_VTABLE
+};
+
+/**
+ * Create a dom_html_table_element object
+ *
+ * \param doc The document object
+ * \param ele The returned element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_html_table_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_element **ele)
+{
+ struct dom_node_internal *node;
+
+ *ele = malloc(sizeof(dom_html_table_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_element_initialise(doc, namespace, prefix, *ele);
+}
+
+/**
+ * Initialise a dom_html_table_element object
+ *
+ * \param doc The document object
+ * \param ele The dom_html_table_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_html_table_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_element *ele)
+{
+ ele->caption = NULL;
+ ele->t_head = NULL;
+ ele->t_foot = NULL;
+ return _dom_html_element_initialise(doc, &ele->base,
+ doc->memoised[hds_TABLE],
+ namespace, prefix);
+}
+
+/**
+ * Finalise a dom_html_table_element object
+ *
+ * \param ele The dom_html_table_element object
+ */
+void _dom_html_table_element_finalise(struct dom_html_table_element *ele)
+{
+ _dom_html_element_finalise(&ele->base);
+}
+
+/**
+ * Destroy a dom_html_table_element object
+ *
+ * \param ele The dom_html_table_element object
+ */
+void _dom_html_table_element_destroy(struct dom_html_table_element *ele)
+{
+ _dom_html_table_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_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_element_destroy(dom_node_internal *node)
+{
+ _dom_html_table_element_destroy((struct dom_html_table_element *) node);
+}
+
+/* The virtual copy function, see src/core/node.c for detail */
+dom_exception _dom_html_table_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_element_get_##attr( \
+ dom_html_table_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_element_set_##attr( \
+ dom_html_table_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(bg_color);
+SIMPLE_GET_SET(border);
+SIMPLE_GET_SET(cell_padding);
+SIMPLE_GET_SET(cell_spacing);
+SIMPLE_GET_SET(frame);
+SIMPLE_GET_SET(rules);
+SIMPLE_GET_SET(summary);
+SIMPLE_GET_SET(width);
+
+/**
+ * Get the caption Attribute
+ *
+ * \param table The dom_html_table_element object
+ */
+dom_exception dom_html_table_element_get_caption(
+ dom_html_table_element *table, dom_html_table_caption_element **caption)
+{
+ dom_node_internal *node_tmp = ((dom_node_internal *)table);
+ dom_html_document *doc = (dom_html_document *)(node_tmp->owner);
+
+ if(table->caption == NULL) {
+ for (node_tmp = node_tmp->first_child; node_tmp != NULL; node_tmp = node_tmp->next) {
+ if((node_tmp->type == DOM_ELEMENT_NODE) &&
+ dom_string_caseless_isequal(doc->memoised[hds_CAPTION],node_tmp->name)) {
+ break;
+ }
+ }
+ table->caption = (dom_html_table_caption_element *)node_tmp;
+ }
+ *caption = (table->caption);
+ return DOM_NO_ERR;
+}
+
+/**
+ * Set the caption Attribute
+ *
+ * \param table The dom_html_table_element object
+ * \param table The dom_html_table_element object
+ */
+dom_exception dom_html_table_element_set_caption(
+ dom_html_table_element *table, dom_html_table_caption_element *caption)
+{
+ dom_node_internal *check_node = ((dom_node_internal *)caption);
+ dom_html_document *doc = (dom_html_document *)(((dom_node_internal *)table)->owner);
+ if(check_node == NULL) {
+ return DOM_HIERARCHY_REQUEST_ERR;
+ }
+ if(!dom_string_caseless_isequal(doc->memoised[hds_CAPTION],check_node->name)) {
+ return DOM_HIERARCHY_REQUEST_ERR;
+ }
+ table->caption = caption;
+ return DOM_NO_ERR;
+}
+
+/**
+ * Get the t_head Attribute
+ *
+ * \param table The dom_html_table_element object
+ */
+dom_exception dom_html_table_element_get_t_head(
+ dom_html_table_element *table, dom_html_table_section_element **t_head)
+{
+ dom_node_internal *node_tmp = ((dom_node_internal *)table);
+ dom_html_document *doc = (dom_html_document *)(node_tmp->owner);
+
+ if(table->t_head == NULL) {
+ for (node_tmp = node_tmp->first_child; node_tmp != NULL; node_tmp = node_tmp->next) {
+ if((node_tmp->type == DOM_ELEMENT_NODE) &&
+ dom_string_caseless_isequal(doc->memoised[hds_THEAD],node_tmp->name)) {
+ break;
+ }
+ }
+ table->t_head = (dom_html_table_section_element *)node_tmp;
+ }
+ *t_head = table->t_head;
+ return DOM_NO_ERR;
+}
+
+/**
+ * Set the t_head Attribute
+ *
+ * \param table The dom_html_table_element object
+ * \param table The dom_html_table_element object
+ */
+dom_exception dom_html_table_element_set_t_head(
+ dom_html_table_element *table, dom_html_table_section_element *t_head)
+{
+ dom_node_internal *check_node = ((dom_node_internal *)t_head);
+ dom_html_document *doc = (dom_html_document *)(((dom_node_internal *)table)->owner);
+ if(check_node == NULL) {
+ return DOM_HIERARCHY_REQUEST_ERR;
+ }
+ if(!dom_string_caseless_isequal(doc->memoised[hds_CAPTION],check_node->name)) {
+ return DOM_HIERARCHY_REQUEST_ERR;
+ }
+ table->t_head = t_head;
+ return DOM_NO_ERR;
+}
+
+/**
+ * Get the t_foot Attribute
+ *
+ * \param table The dom_html_table_element object
+ */
+dom_exception dom_html_table_element_get_t_foot(
+ dom_html_table_element *table, dom_html_table_section_element **t_foot)
+{
+ dom_node_internal *node_tmp = ((dom_node_internal *)table);
+ dom_html_document *doc = (dom_html_document *)(node_tmp->owner);
+
+ if(table->t_foot == NULL) {
+ for (node_tmp = node_tmp->first_child; node_tmp != NULL; node_tmp = node_tmp->next) {
+ if((node_tmp->type == DOM_ELEMENT_NODE) &&
+ dom_string_caseless_isequal(doc->memoised[hds_TFOOT],node_tmp->name)) {
+ break;
+ }
+ }
+ table->t_foot = (dom_html_table_section_element *)node_tmp;
+ }
+ *t_foot = (table->t_foot);
+ return DOM_NO_ERR;
+}
+
+/**
+ * Set the t_foot Attribute
+ *
+ * \param table The dom_html_table_element object
+ */
+dom_exception dom_html_table_element_set_t_foot(
+ dom_html_table_element *table, dom_html_table_section_element *t_foot)
+{
+ dom_node_internal *check_node = ((dom_node_internal *)t_foot); /*< temporary node to check for raised exceptions */
+ dom_html_document *doc = (dom_html_document *)(((dom_node_internal *)table)->owner);
+ if(check_node == NULL) {
+ return DOM_HIERARCHY_REQUEST_ERR;
+ }
+ if(!dom_string_caseless_isequal(doc->memoised[hds_TFOOT],check_node->name)) {
+ return DOM_HIERARCHY_REQUEST_ERR;
+ }
+ table->t_foot = t_foot;
+ return DOM_NO_ERR;
+}
+
+/**
+ * Callback for creating the rows collection
+ *
+ * \param node The dom_html_table_element object
+ * \param ctx The dom_html_document object (void *)
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+bool table_rows_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_table_element object
+ * \param rows The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_get_rows(
+ dom_html_table_element *element,
+ dom_html_collection **rows)
+{
+ dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner;
+ return _dom_html_collection_create(doc, (dom_node_internal *)element,
+ table_rows_callback, (void *)doc, rows);
+}
+
+/**
+ * Callback for creating the tbodies collection
+ *
+ * \param node The dom_html_table_element object
+ * \param ctx The dom_html_document object (void *)
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+bool table_t_bodies_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_TBODY])) {
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Get the tBodies collection
+ *
+ * \param element The dom_html_table_element object
+ * \param t_bodies The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_get_t_bodies(
+ dom_html_table_element *element,
+ dom_html_collection **t_bodies)
+{
+ dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner;
+ return _dom_html_collection_create(doc, (dom_node_internal *)element,
+ table_t_bodies_callback, (void *)doc, t_bodies);
+}
+
+/**
+ * Get or Create the table caption
+ *
+ * \param element The dom_html_table_element object
+ * \param caption The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_create_caption(
+ dom_html_table_element *element,
+ dom_html_element **caption)
+{
+ dom_exception exp;
+ if((exp = dom_html_table_element_get_caption(element,
+ (dom_html_table_caption_element **)caption)) != DOM_NO_ERR) {
+ return exp;
+ }
+ if((*caption) == NULL) {
+ dom_html_document *doc = (dom_html_document *)
+ ((dom_node_internal *) element)->owner;
+ exp = _dom_html_table_caption_element_create(doc,
+ ((dom_node_internal *)element)->namespace,
+ ((dom_node_internal *)element)->prefix,
+ (dom_html_table_caption_element **)caption);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+ _dom_node_append_child((dom_node_internal *)element,
+ (dom_node_internal *)*caption,
+ (dom_node_internal **)caption);
+ element->caption = (dom_html_table_caption_element *)*caption;
+
+ }
+ return DOM_NO_ERR;
+}
+
+/**
+ * Delete the table caption, if one exists
+ *
+ * \param element The dom_html_table_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_delete_caption(
+ dom_html_table_element *element)
+{
+ dom_html_table_caption_element *caption;
+ dom_html_table_element_get_caption(element, &caption);
+ _dom_node_remove_child((dom_node_internal *)element,
+ (dom_node_internal *)caption,
+ (dom_node_internal **)&caption);
+ element->caption = NULL;
+ return DOM_NO_ERR;
+}
+
+/**
+ * Get or Create the table Foot
+ *
+ * \param element The dom_html_table_element object
+ * \param t_foot The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_create_t_foot(
+ dom_html_table_element *element,
+ dom_html_element **t_foot)
+{
+ dom_exception exp;
+ exp = dom_html_table_element_get_t_foot(element,
+ (dom_html_table_section_element **)t_foot);
+ if(exp !=DOM_NO_ERR) {
+ return exp;
+ }
+ if((*t_foot) == NULL) {
+ dom_html_document *doc = (dom_html_document *)
+ ((dom_node_internal *) element)->owner;
+ exp = _dom_html_table_section_element_create(doc,
+ doc->memoised[hds_TFOOT],
+ ((dom_node_internal *)element)->namespace,
+ ((dom_node_internal *)element)->prefix,
+ (dom_html_table_section_element **)t_foot);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+ _dom_node_append_child((dom_node_internal *)element,
+ (dom_node_internal *)*t_foot,
+ (dom_node_internal **)t_foot);
+ element->t_foot = (dom_html_table_section_element *)*t_foot;
+
+ }
+ return DOM_NO_ERR;
+}
+
+/**
+ * Delete the table Foot, if one exists
+ *
+ * \param element The dom_html_table_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_delete_t_foot(
+ dom_html_table_element *element)
+{
+ dom_html_table_section_element *t_foot;
+ dom_html_table_element_get_t_foot(element, &t_foot);
+ _dom_node_remove_child((dom_node_internal *)element,
+ (dom_node_internal *)t_foot,
+ (dom_node_internal **)&t_foot);
+ element->t_foot = NULL;
+ return DOM_NO_ERR;
+}
+
+/**
+ * Get or Create the table Head
+ *
+ * \param element The dom_html_table_element object
+ * \param t_head The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_create_t_head(
+ dom_html_table_element *element,
+ dom_html_element **t_head)
+{
+ dom_html_table_element_get_t_head(element,
+ (dom_html_table_section_element **)t_head);
+ if((*t_head) == NULL) {
+ dom_exception exp;
+ dom_html_document *doc = (dom_html_document *)
+ ((dom_node_internal *) element)->owner;
+ exp = _dom_html_table_section_element_create(doc,
+ doc->memoised[hds_THEAD],
+ ((dom_node_internal *)element)->namespace,
+ ((dom_node_internal *)element)->prefix,
+ (dom_html_table_section_element **)t_head);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+ _dom_node_append_child((dom_node_internal *)element,
+ (dom_node_internal *)*t_head,
+ (dom_node_internal **)t_head);
+ element->t_head = (dom_html_table_section_element *)*t_head;
+
+ }
+ return DOM_NO_ERR;
+}
+
+/**
+ * Delete the table Head, if one exists
+ *
+ * \param element The dom_html_table_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_delete_t_head(
+ dom_html_table_element *element)
+{
+ dom_html_table_section_element *t_head;
+ dom_html_table_element_get_t_head(element, &t_head);
+ _dom_node_remove_child((dom_node_internal *)element,
+ (dom_node_internal *)t_head,
+ (dom_node_internal **)&t_head);
+ element->t_head = NULL;
+ return DOM_NO_ERR;
+}
+
+/**
+ * Get or Create the table Body
+ *
+ * \param element The dom_html_table_element object
+ * \param t_head The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_create_t_body(
+ dom_html_table_element *element,
+ dom_html_table_section_element **t_body)
+{
+ dom_html_collection *t_bodies;
+ uint32_t len;
+ dom_html_table_element_get_t_bodies(element,
+ &t_bodies);
+ dom_html_collection_get_length(t_bodies,
+ &len);
+
+ if(len == 0) {
+ dom_exception exp;
+ dom_html_document *doc = (dom_html_document *)
+ ((dom_node_internal *) element)->owner;
+ exp = _dom_html_table_section_element_create(doc,
+ doc->memoised[hds_TBODY],
+ ((dom_node_internal *)element)->namespace,
+ ((dom_node_internal *)element)->prefix,
+ t_body);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+ return _dom_node_append_child((dom_node_internal *)element,
+ (dom_node_internal *)*t_body,
+ (dom_node_internal **)t_body);
+
+ } else {
+ return dom_html_collection_item(t_bodies,
+ 0, (dom_node **)t_body);
+ }
+ return DOM_NO_ERR;
+}
+/**
+ * Insert a new Row into the table
+ *
+ * \param element The dom_html_table_element object
+ * \param index The Index to insert the Row
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_insert_row(
+ dom_html_table_element *element,
+ int32_t index,
+ dom_html_element **row)
+{
+ dom_exception exp;
+ dom_html_collection* rows;
+ uint32_t len;
+ dom_html_document *doc = (dom_html_document *)
+ ((dom_node_internal *) element)->owner;
+
+ exp = dom_html_table_element_get_rows(element,
+ &rows);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+ exp = dom_html_collection_get_length(rows,
+ &len);
+
+ exp = _dom_html_table_row_element_create(doc,
+ ((dom_node_internal *)element)->namespace,
+ ((dom_node_internal *)element)->prefix,
+ (dom_html_table_row_element **)row);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+
+ if(index > (int32_t)len || index < -1) {
+ return DOM_INDEX_SIZE_ERR;
+ } else if(len == 0) {
+ dom_html_table_section_element *new_body;
+ exp = dom_html_table_element_create_t_body(element,
+ &new_body);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+
+ return _dom_node_append_child((dom_node_internal *)new_body,
+ (dom_node_internal *)*row,
+ (dom_node_internal **)row);
+
+ } else {
+ if(index ==-1) {
+ index = (int32_t)len;
+ }
+
+ dom_html_collection* rows;
+ dom_html_table_section_element *t_head;
+ dom_html_table_section_element *t_foot;
+ uint32_t window_len = 0, section_len;
+
+ dom_html_table_element_get_t_head(element, &t_head);
+ dom_html_table_section_element_get_rows(t_head, &rows);
+ dom_html_collection_get_length(rows, &section_len);
+
+ if(window_len + section_len > (uint32_t)index ||
+ window_len + section_len == len) {
+ return dom_html_table_section_element_insert_row(t_head,
+ index-window_len, row);
+ }
+
+ window_len += section_len;
+
+ dom_node_internal *n = (dom_node_internal *)element;
+
+ for (n = n->first_child; n != NULL; n = n->next) {
+ if((n->type == DOM_ELEMENT_NODE) &&
+ dom_string_caseless_isequal(doc->memoised[hds_TBODY],n->name)) {
+
+ dom_html_table_section_element_get_rows((dom_html_table_section_element *)n, &rows);
+ dom_html_collection_get_length(rows, &section_len);
+
+ if(window_len + section_len > (uint32_t)index ||
+ window_len + section_len == len) {
+ return dom_html_table_section_element_insert_row(
+ (dom_html_table_section_element *)n,
+ index-window_len, row);
+ }
+
+ window_len += section_len;
+ }
+ }
+ dom_html_table_element_get_t_foot(element, &t_foot);
+ dom_html_table_section_element_get_rows(t_foot, &rows);
+ dom_html_collection_get_length(rows, &section_len);
+ if(window_len + section_len > (uint32_t)index ||
+ window_len +section_len == len) {
+ return dom_html_table_section_element_insert_row(t_foot,
+ index-window_len, row);
+ }
+ return DOM_INDEX_SIZE_ERR;
+ }
+}
+/**
+ * Delete the table Head, if one exists
+ *
+ * \param element The dom_html_table_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_element_delete_row(
+ dom_html_table_element *element,
+ int32_t index)
+{
+ dom_exception exp;
+ dom_html_collection* rows;
+ uint32_t len;
+ dom_html_document *doc = (dom_html_document *)
+ ((dom_node_internal *) element)->owner;
+
+ exp = dom_html_table_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 >= (int32_t)len || index < -1 || len ==0) {
+ return DOM_INDEX_SIZE_ERR;
+ } else {
+ if(index ==-1) {
+ index = (int32_t)len-1;
+ }
+ dom_html_collection* rows;
+ dom_html_table_section_element *t_head;
+ dom_html_table_section_element *t_foot;
+ uint32_t window_len = 0, section_len;
+ dom_html_table_element_get_t_head(element, &t_head);
+ dom_html_table_section_element_get_rows(t_head, &rows);
+ dom_html_collection_get_length(rows, &section_len);
+ if(window_len + section_len > (uint32_t)index) {
+ return dom_html_table_section_element_delete_row(t_head,
+ index-window_len);
+ }
+ window_len += section_len;
+ dom_node_internal *n = (dom_node_internal *)element;
+ for (n = n->first_child; n != NULL; n = n->next) {
+ if((n->type == DOM_ELEMENT_NODE) &&
+ dom_string_caseless_isequal(doc->memoised[hds_TBODY],n->name)) {
+ dom_html_table_section_element_get_rows((dom_html_table_section_element *)n, &rows);
+ dom_html_collection_get_length(rows, &section_len);
+ if(window_len + section_len > (uint32_t)index) {
+ return dom_html_table_section_element_delete_row(
+ (dom_html_table_section_element *)n,
+ index-window_len);
+ }
+ window_len += section_len;
+ }
+ }
+ exp = dom_html_table_element_get_t_foot(element, &t_foot);
+ dom_html_table_section_element_get_rows(t_foot, &rows);
+ dom_html_collection_get_length(rows, &section_len);
+ if(window_len + section_len > (uint32_t)index) {
+ return dom_html_table_section_element_delete_row(t_foot,
+ index-window_len);
+ }
+ return DOM_INDEX_SIZE_ERR;
+ }
+
+}
diff --git a/src/html/html_table_element.h b/src/html/html_table_element.h
index 2e182d5..caabbe8 100644
--- a/src/html/html_table_element.h
+++ b/src/html/html_table_element.h
@@ -3,5 +3,61 @@
* 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_element_h_
+#define dom_internal_html_table_element_h_
+
+#include <dom/html/html_table_element.h>
+#include "html/html_element.h"
+
+struct dom_html_table_element {
+ struct dom_html_element base;
+ /**< The base class */
+ dom_html_table_caption_element* caption;
+ /**< The caption associated with the table*/
+ dom_html_table_section_element* t_head;
+ /**< The thead element associated with the table*/
+ dom_html_table_section_element* t_foot;
+ /**< The tfoot element associated with the table*/
+};
+
+/* Create a dom_html_table_element object */
+dom_exception _dom_html_table_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_element **ele);
+
+/* Initialise a dom_html_table_element object */
+dom_exception _dom_html_table_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_element *ele);
+
+/* Finalise a dom_html_table_element object */
+void _dom_html_table_element_finalise(struct dom_html_table_element *ele);
+
+/* Destroy a dom_html_table_element object */
+void _dom_html_table_element_destroy(struct dom_html_table_element *ele);
+
+/* The protected virtual functions */
+dom_exception _dom_html_table_element_parse_attribute(dom_element *ele,
+ dom_string *name, dom_string *value,
+ dom_string **parsed);
+void _dom_virtual_html_table_element_destroy(dom_node_internal *node);
+dom_exception _dom_html_table_element_copy(dom_node_internal *old,
+ dom_node_internal **copy);
+
+#define DOM_HTML_TABLE_ELEMENT_PROTECT_VTABLE \
+ _dom_html_table_element_parse_attribute
+
+#define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_ELEMENT \
+ _dom_virtual_html_table_element_destroy, \
+ _dom_html_table_element_copy
+
+#endif
+
+bool table_rows_callback(struct dom_node_internal *node, void *ctx);
+bool table_t_bodies_callback(struct dom_node_internal *node, void *ctx);
+dom_exception dom_html_table_element_create_t_body(
+ dom_html_table_element *element,
+ dom_html_table_section_element **t_body);
diff --git a/src/html/html_tablecell_element.c b/src/html/html_tablecell_element.c
index f8eaf01..cc596c1 100644
--- a/src/html/html_tablecell_element.c
+++ b/src/html/html_tablecell_element.c
@@ -191,6 +191,7 @@ dom_exception dom_html_table_cell_element_get_cell_index(
}
n = n->parent;
}
+ dom_node_internal *root = n;
while(n != NULL) {
if(n == (dom_node_internal *)table_cell) {
break;
@@ -207,18 +208,16 @@ dom_exception dom_html_table_cell_element_get_cell_index(
} else {
/* No children and siblings */
struct dom_node_internal *parent = n->parent;
-
- while (parent !=NULL) {
- if(n == parent->last_child) {
- n = parent;
- parent = parent->parent;
- } else {
- break;
- }
-
+ while (n == parent->last_child &&
+ n != root) {
+ n = parent;
+ parent = parent->parent;
}
- if(parent == NULL) {
+
+ if(n == root) {
n = NULL;
+ } else {
+ n = n->next;
}
}
}
diff --git a/src/html/html_tablerow_element.c b/src/html/html_tablerow_element.c
index 2e182d5..fb3e27b 100644
--- a/src/html/html_tablerow_element.c
+++ b/src/html/html_tablerow_element.c
@@ -3,5 +3,373 @@
* 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_tablerow_element.h>
+#include <dom/html/html_table_element.h>
+
+#include "html/html_document.h"
+#include "html/html_tablerow_element.h"
+#include "html/html_collection.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_ROW_ELEMENT
+ },
+ DOM_HTML_TABLE_ROW_ELEMENT_PROTECT_VTABLE
+};
+
+/**
+ * Create a dom_html_table_row_element table_row
+ *
+ * \param doc The document table_row
+ * \param ele The returned element table_row
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_html_table_row_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_row_element **ele)
+{
+ struct dom_node_internal *node;
+
+ *ele = malloc(sizeof(dom_html_table_row_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_row_element_initialise(doc, namespace, prefix, *ele);
+}
+
+/**
+ * Initialise a dom_html_table_row_element table_row
+ *
+ * \param doc The document table_row
+ * \param ele The dom_html_table_row_element table_row
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_html_table_row_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_row_element *ele)
+{
+ return _dom_html_element_initialise(doc, &ele->base,
+ doc->memoised[hds_TR],
+ namespace, prefix);
+}
+
+/**
+ * Finalise a dom_html_table_row_element table_row
+ *
+ * \param ele The dom_html_table_row_element table_row
+ */
+void _dom_html_table_row_element_finalise(struct dom_html_table_row_element *ele)
+{
+ _dom_html_element_finalise(&ele->base);
+}
+
+/**
+ * Destroy a dom_html_table_row_element table_row
+ *
+ * \param ele The dom_html_table_row_element table_row
+ */
+void _dom_html_table_row_element_destroy(struct dom_html_table_row_element *ele)
+{
+ _dom_html_table_row_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_row_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_row_element_destroy(dom_node_internal *node)
+{
+ _dom_html_table_row_element_destroy((struct dom_html_table_row_element *) node);
+}
+
+/* The virtual copy function, see src/core/node.c for detail */
+dom_exception _dom_html_table_row_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_row_element_get_##attr( \
+ dom_html_table_row_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_row_element_set_##attr( \
+ dom_html_table_row_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(bg_color);
+SIMPLE_GET_SET(ch);
+SIMPLE_GET_SET(ch_off);
+SIMPLE_GET_SET(v_align);
+
+/**
+ * Get the index of the Row in logical order
+ *
+ * \param element The dom_html_table_row_element object
+ * \param index The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_row_element_get_row_index(
+ dom_html_table_row_element *table_row, int32_t *row_index)
+{
+ dom_node_internal *n = ((dom_node_internal *)table_row)->parent;
+ dom_node_internal *parent = n;
+ dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) table_row)->owner;
+ uint32_t count = 0;
+ for(n = n->first_child; n != (dom_node_internal *)table_row;
+ n = n->next) {
+ if(n->type == DOM_ELEMENT_NODE &&
+ dom_string_caseless_isequal(n->name,doc->memoised[hds_TR])) {
+ count += 1;
+ }
+ }
+
+ if(dom_string_caseless_isequal((parent->parent)->name, doc->memoised[hds_TABLE]) &&
+ dom_string_caseless_isequal(parent->name, doc->memoised[hds_THEAD])
+ ) {
+ *row_index = count;
+ }else if(dom_string_caseless_isequal((parent->parent)->name, doc->memoised[hds_TABLE]) &&
+ (dom_string_caseless_isequal(parent->name, doc->memoised[hds_TBODY]) ||
+ dom_string_caseless_isequal(parent->name, doc->memoised[hds_TFOOT]))) {
+ uint32_t len;
+ n = parent->parent;
+ dom_html_table_section_element *t_head;
+ dom_html_collection *rows;
+ dom_html_table_element_get_t_head(
+ (dom_html_table_element *)(parent->parent),
+ &t_head);
+ dom_html_table_section_element_get_rows(t_head,
+ &rows);
+ dom_html_collection_get_length(rows,
+ &len);
+ count += len;
+ for(n = n->first_child;n != parent && n != NULL;
+ n = n->next) {
+ if(dom_string_caseless_isequal(n->name, doc->memoised[hds_TBODY])) {
+ dom_html_table_section_element_get_rows(
+ (dom_html_table_section_element *)n,
+ &rows);
+ dom_html_collection_get_length(rows, &len);
+ count += len;
+ }
+ }
+ *row_index = (int32_t)count;
+
+ } else {
+ return DOM_HIERARCHY_REQUEST_ERR;
+ }
+ return DOM_NO_ERR;
+}
+
+/**
+ * Get the index of a row within its Section
+ *
+ * \param element The dom_html_table_row_element object
+ * \param index The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_row_element_get_section_row_index(
+ dom_html_table_row_element *table_row, int32_t *section_row_index)
+{
+ dom_node_internal *n = ((dom_node_internal *)table_row)->parent;
+ dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) table_row)->owner;
+ int32_t count = 0;
+ for(n = n->first_child; n != (dom_node_internal *)table_row;
+ n = n->next) {
+ if(n->type == DOM_ELEMENT_NODE &&
+ dom_string_caseless_isequal(n->name, doc->memoised[hds_TR])) {
+ count += 1;
+ }
+ }
+ *section_row_index = count;
+ return DOM_NO_ERR;
+}
+
+/**
+ * Callback for creating the Cells collection
+ *
+ * \param node The dom_node_internal object
+ * \param ctx The dom_html_document object (void *)
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+bool table_cells_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_TD])) {
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Get the Cells collection
+ *
+ * \param element The dom_html_table_element object
+ * \param t_bodies The Status
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_row_element_get_cells(
+ dom_html_table_row_element *element,
+ dom_html_collection **cells)
+{
+ dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner;
+ return _dom_html_collection_create(doc, (dom_node_internal *)element,
+ table_cells_callback, (void *)doc, cells);
+}
+
+/**
+ * Insert Cell before the given Index
+ *
+ * \param element The dom_html_table_row_element object
+ * \param index The Index of the Cell node to be inserted
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_row_element_insert_cell(
+ dom_html_table_row_element *element,
+ int32_t index, dom_html_element **cell) {
+ 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 *cells; /*< The collection of cells in input table_row_element*/
+ uint32_t len; /*< The size of the cell collection */
+ dom_exception exp; /*< Variable for getting the exceptions*/
+ exp = _dom_html_element_create(doc, doc->memoised[hds_TD],
+ ((dom_node_internal *)element)->namespace,
+ ((dom_node_internal *)element)->prefix,
+ cell);
+ if(exp != DOM_NO_ERR)
+ return exp;
+
+ exp = dom_html_table_row_element_get_cells(element, &cells);
+ if(exp != DOM_NO_ERR)
+ return exp;
+
+ exp = dom_html_collection_get_length(cells, &len);
+ if(exp != DOM_NO_ERR)
+ return exp;
+
+ if(index < -1 || index > (int32_t)len) {
+ /* Check for index validity */
+ return DOM_INDEX_SIZE_ERR;
+ } else if(index == -1 || index == (int32_t)len) {
+ return _dom_node_append_child((dom_node_internal *)element,
+ (dom_node_internal *)*cell,
+ (dom_node_internal **)cell);
+ } else {
+ dom_html_collection_item(cells,
+ index, &node);
+ return _dom_node_insert_before((dom_node_internal *)element,
+ (dom_node_internal *)*cell, (dom_node_internal *)node,
+ (dom_node_internal **)cell);
+ }
+}
+
+/**
+ * Delete Cell at given Index
+ *
+ * \param element The dom_html_table_row_element object
+ * \param index The Index of the Cell node to be deleted
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_table_row_element_delete_cell(
+ dom_html_table_row_element *element,
+ int32_t index) {
+ dom_node *node; /*< The node at the (index)th position*/
+
+ dom_html_collection *cells; /*< The collection of rows in input table_row_element*/
+ uint32_t len; /*< The size of the row collection */
+
+ dom_exception exp; /*< Temporary variable to store & check the exceptions*/
+
+ exp = dom_html_table_row_element_get_cells(element, &cells);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+
+ exp = dom_html_collection_get_length(cells, &len);
+ if(exp != DOM_NO_ERR) {
+ return exp;
+ }
+
+ if(index < -1 || index >= (int32_t)len || len ==0) {
+ /* Check for index validity */
+ return DOM_INDEX_SIZE_ERR;
+ } else if(index == -1) {
+ exp = dom_html_collection_item(cells,
+ len-1, &node);
+ } else {
+ exp = dom_html_collection_item(cells,
+ index, &node);
+ }
+ return _dom_node_remove_child((dom_node_internal *)element,
+ (dom_node_internal *)node,
+ (dom_node_internal **)&node);
+
+}
+
diff --git a/src/html/html_tablerow_element.h b/src/html/html_tablerow_element.h
index 2e182d5..2401790 100644
--- a/src/html/html_tablerow_element.h
+++ b/src/html/html_tablerow_element.h
@@ -3,5 +3,51 @@
* 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_row_element_h_
+#define dom_internal_html_table_row_element_h_
+
+#include <dom/html/html_tablerow_element.h>
+#include "html/html_element.h"
+
+struct dom_html_table_row_element {
+ struct dom_html_element base;
+ /**< The base class */
+};
+
+/* Create a dom_html_table_row_element object */
+dom_exception _dom_html_table_row_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_row_element **ele);
+
+/* Initialise a dom_html_table_row_element object */
+dom_exception _dom_html_table_row_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_table_row_element *ele);
+
+/* Finalise a dom_html_table_row_element object */
+void _dom_html_table_row_element_finalise(struct dom_html_table_row_element *ele);
+
+/* Destroy a dom_html_table_row_element object */
+void _dom_html_table_row_element_destroy(struct dom_html_table_row_element *ele);
+
+/* The protected virtual functions */
+dom_exception _dom_html_table_row_element_parse_attribute(dom_element *ele,
+ dom_string *name, dom_string *value,
+ dom_string **parsed);
+void _dom_virtual_html_table_row_element_destroy(dom_node_internal *node);
+dom_exception _dom_html_table_row_element_copy(dom_node_internal *old,
+ dom_node_internal **copy);
+
+#define DOM_HTML_TABLE_ROW_ELEMENT_PROTECT_VTABLE \
+ _dom_html_table_row_element_parse_attribute
+
+#define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_ROW_ELEMENT \
+ _dom_virtual_html_table_row_element_destroy, \
+ _dom_html_table_row_element_copy
+
+#endif
+bool table_cells_callback(struct dom_node_internal *node, void *ctx);
+
diff --git a/src/html/html_tablesection_element.c b/src/html/html_tablesection_element.c
index 7468d01..b35cfb4 100644
--- a/src/html/html_tablesection_element.c
+++ b/src/html/html_tablesection_element.c
@@ -12,6 +12,7 @@
#include "html/html_document.h"
#include "html/html_tablesection_element.h"
+#include "html/html_tablerow_element.h"
#include "html/html_collection.h"
#include "html/html_element.h"
@@ -169,8 +170,7 @@ 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]))
- {
+ ((dom_html_document *)ctx)->memoised[hds_TR])) {
return true;
}
return false;
@@ -179,7 +179,7 @@ bool table_section_callback(struct dom_node_internal *node, void *ctx)
/**
* Get the rows collection
*
- * \param element The dom_html_section_element object
+ * \param element The dom_html_table_section_element object
* \param rows The Status
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
@@ -188,21 +188,20 @@ dom_exception dom_html_table_section_element_get_rows(
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,
+ return _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 element The dom_html_table_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) {
+ int32_t index, dom_html_element **new_row) {
dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner;
dom_node *node; /*< The node at the (index)th position*/
@@ -210,10 +209,10 @@ dom_exception dom_html_table_section_element_insert_row(
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],
+ exp = _dom_html_table_row_element_create(doc,
((dom_node_internal *)element)->namespace,
((dom_node_internal *)element)->prefix,
- newRow);
+ (dom_html_table_row_element **)new_row);
if(exp != DOM_NO_ERR)
return exp;
@@ -225,47 +224,26 @@ dom_exception dom_html_table_section_element_insert_row(
if(exp != DOM_NO_ERR)
return exp;
- if(index < -1 || (uint32_t)index > len) {
+ if(index < -1 || index > (int32_t)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) {
+ } else if(index == -1 || index == (int32_t)len) {
+ return _dom_node_append_child((dom_node_internal *)element,
+ (dom_node_internal *)*new_row,
+ (dom_node_internal **)new_row);
+ } else {
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;
- }
+ return _dom_node_insert_before((dom_node_internal *)element,
+ (dom_node_internal *)*new_row, (dom_node_internal *)node,
+ (dom_node_internal **)new_row);
}
-
- /*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 element The dom_html_table_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.
*/
@@ -289,7 +267,7 @@ dom_exception dom_html_table_section_element_delete_row(
return exp;
}
- if(index < -1 || (uint32_t)index >= len) {
+ if(index < -1 || index >= (int32_t)len) {
/* Check for index validity */
return DOM_INDEX_SIZE_ERR;
} else if(index == -1) {
@@ -299,20 +277,9 @@ dom_exception dom_html_table_section_element_delete_row(
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);
+ exp = _dom_node_remove_child((dom_node_internal *)element,
+ (dom_node_internal *)node,
+ (dom_node_internal **)&node);
return DOM_NO_ERR;
}
diff --git a/src/html/html_tablesection_element.h b/src/html/html_tablesection_element.h
index fcab1cb..387882a 100644
--- a/src/html/html_tablesection_element.h
+++ b/src/html/html_tablesection_element.h
@@ -10,8 +10,8 @@
#define dom_internal_html_table_section_element_h_
#include <dom/html/html_tablesection_element.h>
-#include "html/html_element.h"
+#include "html/html_element.h"
struct dom_html_table_section_element {
struct dom_html_element base;
diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm
index 78d5e7e..8953047 100644
--- a/test/DOMTSHandler.pm
+++ b/test/DOMTSHandler.pm
@@ -44,6 +44,10 @@ our %special_type = (
CDATASection => "dom_cdata_section *",
HTMLAnchorElement => "dom_html_anchor_element *",
HTMLElement => "dom_html_element *",
+ HTMLTableCaptionElement => "dom_html_table_caption_element *",
+ HTMLTableSectionElement => "dom_html_table_section_element *",
+ HTMLTableElement => "dom_html_table_element *",
+ HTMLTableRowElement => "dom_html_table_row_element *",
);
our %special_prefix = (
DOMString => "dom_string",
@@ -57,6 +61,20 @@ our %special_prefix = (
HTMLHRElement => "dom_html_hr_element",
HTMLBRElement => "dom_html_br_element",
HTMLLIElement => "dom_html_li_element",
+ HTMLTableCaptionElement => "dom_html_table_caption_element",
+ HTMLTableSectionElement => "dom_html_table_section_element",
+ HTMLIsIndexElement => "dom_html_isindex_element",
+ caption => "dom_html_table_caption_element *",
+ section => "dom_html_table_section_element *",
+ createCaption => "dom_html_element *",
+ createTHead => "dom_html_element *",
+ createTFoot => "dom_html_element *",
+ deleteCaption => "dom_html_element *",
+ deleteTHead => "dom_html_element *",
+ deleteTFoot => "dom_html_element *",
+ insertRow => "dom_html_element *",
+ deleteRow => "dom_html_element *",
+ form => "dom_html_form_element *",
);
our %unref_prefix = (
@@ -164,10 +182,14 @@ sub new {
# The name of the current List/Collection
list_name => "",
# The number of items of the current List/Collection
+ list_last_name => [],
+ # The number of items of the current List/Collection
list_num => 0,
# Whether List/Collection has members
list_hasmem => 0,
# The type of the current List/Collection
+ member_list_declared => 0,
+ # The type of the current List/Collection
list_type => "",
# Whether we are in exception assertion
exception => 0,
@@ -389,6 +411,7 @@ int main(int argc, char **argv)
perror("chdir (\\"$self->{chdir})\\"");
return 1;
}
+ int list_temp[100], count = -1;
__EOF__
}
@@ -442,7 +465,6 @@ sub generate_list {
# Yes, we are in List/Collection declaration
# Firstly, enclose the Array declaration
print "};\n";
-
# Now, we should create the list * for the List/Collection
# Note, we should deal with "int" or "string" type with different params.
if ($self->{"list_type"} eq "char *") {
@@ -450,18 +472,37 @@ sub generate_list {
}
if ($self->{"list_type"} eq "int *") {
print $self->{"list_name"}." = list_new(INT);\n";
+ while(defined ($x = pop @{$self->{"list_last_name"}})) {
+ print $x." = list_new(INT);\n";
+ }
}
+ while(defined($x = pop(@{$self->{"list_last_name"}}))) {
+ print $x." = list_new(DOM_STRING);\n";
+ }
+ $self->{"member_list_declared"} = 1;
if ($self->{"list_type"} eq "") {
die "A List/Collection has children member but no type is impossible!";
}
- for (my $i = 0; $i < $self->{"list_num"}; $i++) {
- # Use *(char **) to convert char *[] to char *
- print "list_add(".$self->{"list_name"}.", *(char **)(".$self->{"list_name"}."Array + $i));\n";
+ if ($self->{"list_type"} eq "int *") {
+
+ for (my $i = 0; $i < $self->{"list_num"}; $i++) {
+ # Use *(char **) to convert char *[] to char *
+ print "list_add(".$self->{"list_name"}.", (int *)(".$self->{"list_name"}."Array) + $i);\n";
+ }
+ } else {
+ for (my $i = 0; $i < $self->{"list_num"}; $i++) {
+ # Use *(char **) to convert char *[] to char *
+ print "list_add(".$self->{"list_name"}.", *(char **)(".$self->{"list_name"}."Array + $i));\n";
+ }
}
} else {
if ($self->{"list_name"} ne "") {
#TODO: generally, we set the list type as dom_string, but it may be dom_node
- print $self->{"list_name"}." = list_new(DOM_STRING);\n";
+ if( $self->{"member_list_declared"} eq 1) {
+ print $self->{"list_name"}." = list_new(DOM_STRING);\n";
+ } else {
+ push(@{$self->{"list_last_name"}}, $self->{"list_name"});
+ }
$self->{"list_type"} = "DOMString";
}
}
@@ -553,14 +594,19 @@ sub generate_framework_statement {
if (exists $ats->{"obj"}) {
$obj = $ats->{"obj"};
} else {
- $obj = $ats->{"item"}
+ $obj = $ats->{"item"};
}
-
+
if (not $self->{"var"}->{$col} =~ /^(List|Collection)/) {
die "Append data to some non-list type!";
}
-
- print "list_add($col, $obj);\n";
+ $type = $self->{"var"}->{$obj};
+ if ($type eq "int") {
+ print "\nlist_temp[++count] =$obj;\n";
+ print "list_add($col, &list_temp[count]);\n\n";
+ } else {
+ print "list_add($col, $obj);\n";
+ }
}
case [qw(plus subtract mult divide)] {
@@ -681,6 +727,8 @@ sub generate_method {
$method = to_cmethod($ats{'interface'}, $en);
my $cast = to_attribute_cast($ats{'interface'});
+ my $get_attribute = $node->getAttribute("name");
+ my $cast_get_attribute = to_get_attribute_cast($get_attribute);
my $ns = $dd->find("parameters/param", $node);
my $params = "${cast}$ats{'obj'}";
for ($count = 1; $count <= $ns->size; $count++) {
@@ -746,7 +794,7 @@ sub generate_method {
# Indicate that we have created a temp node
$temp_node = 1;
} else {
- $params = $params.", (void *) \&$ats{'var'}";
+ $params = $params.", $cast_get_attribute\&$ats{'var'}";
$unref = $self->param_unref($ats{'var'});
}
}
@@ -808,6 +856,8 @@ sub generate_attribute_fetcher {
my $fetcher = to_attribute_fetcher($ats{'interface'}, "$en");
my $cast = to_attribute_cast($ats{'interface'});
+ my $get_attribute = $node->getAttribute("name");
+ my $cast_get_attribute = to_get_attribute_cast($get_attribute);
my $unref = 0;
my $temp_node = 0;
# Deal with the situation like
@@ -833,7 +883,7 @@ sub generate_attribute_fetcher {
$temp_node = 1;
} else {
$unref = $self->param_unref($ats{'var'});
- print "\texp = $fetcher(${cast}$ats{'obj'}, \&$ats{'var'});\n";
+ print "\texp = $fetcher(${cast}$ats{'obj'}, ${cast_get_attribute}\&$ats{'var'});\n";
}
@@ -1424,7 +1474,26 @@ sub get_prefix {
}
return $prefix;
}
+sub to_get_attribute_cast {
+ my $type = shift;
+ my $ret = get_get_attribute_prefix($type);
+ if($ret eq "") {
+ return $ret;
+ }
+ $ret =~ s/h_t_m_l/html/;
+ return "(${ret} *)";
+}
+sub get_get_attribute_prefix {
+ my $type = shift;
+
+ if (exists $special_prefix{$type}) {
+ $prefix = $special_prefix{$type};
+ } else {
+ $prefix = "";
+ }
+ return $prefix;
+}
# This function remain unsed
sub get_suffix {
my $type = shift;
diff --git a/test/testcases/tests/level1/html/HTMLCollection01.xml.notimpl b/test/testcases/tests/level1/html/HTMLCollection04.xml.kfail
index fd2cfe4..5d78405 100644
--- a/test/testcases/tests/level1/html/HTMLCollection01.xml.notimpl
+++ b/test/testcases/tests/level1/html/HTMLCollection04.xml.kfail
@@ -16,34 +16,44 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-->
<!DOCTYPE test SYSTEM "dom1.dtd">
-<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLCollection01">
+<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLCollection04">
<metadata>
-<title>HTMLCollection01</title>
+<title>HTMLCollection04</title>
<creator>NIST</creator>
<description>
- An individual node may be accessed by either ordinal index, the node's
- name or id attributes. (Test ordinal index).
+ HTMLCollections are live, they are automatically updated when the
+ underlying document is changed.
- Retrieve the first TABLE element and create a HTMLCollection by invoking
- the "rows" attribute. The item located at ordinal index 0 is further
- retrieved and its "rowIndex" attribute is examined.
+ Create a HTMLCollection object by invoking the rows attribute of the
+ first TABLE element and examine its length, then add a new row and
+ re-examine the length.
</description>
<contributor>Rick Rivello</contributor>
<date qualifier="created">2002-05-01</date>
-<subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535"/>
+<subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551"/>
</metadata>
<var name="nodeList" type="NodeList"/>
<var name="testNode" type="Node"/>
-<var name="rowNode" type="Node"/>
+<var name="rowLength1" type="int"/>
+<var name="rowLength2" type="int"/>
<var name="rowsnodeList" type="HTMLCollection"/>
+<var name="newRow" type="HTMLElement"/>
<var name="vrowindex" type="int" />
<var name="doc" type="Document"/>
-<load var="doc" href="collection" willBeModified="false"/>
+<var name="result" type="List"/>
+<var name="expectedResult" type="List">
+<member>4</member>
+<member>5</member>
+</var>
+<load var="doc" href="collection" willBeModified="true"/>
<getElementsByTagName interface="Document" obj="doc" var="nodeList" tagname='"table"'/>
<assertSize collection="nodeList" size="1" id="Asize"/>
<item interface="NodeList" obj="nodeList" var="testNode" index="0"/>
<rows interface="HTMLTableElement" obj="testNode" var="rowsnodeList"/>
-<item interface="HTMLCollection" obj="rowsnodeList" var="rowNode" index="0"/>
-<rowIndex interface="HTMLTableRowElement" obj="rowNode" var="vrowindex"/>
-<assertEquals actual="vrowindex" expected="0" id="rowIndexLink" ignoreCase="false"/>
+<length interface="HTMLCollection" obj="rowsnodeList" var="rowLength1"/>
+<append collection="result" item="rowLength1"/>
+<insertRow interface="HTMLTableElement" obj="testNode" var="newRow" index="4"/>
+<length interface="HTMLCollection" obj="rowsnodeList" var="rowLength2"/>
+<append collection="result" item="rowLength2"/>
+<assertEquals actual="result" expected="expectedResult" id="rowIndexLink" ignoreCase="false"/>
</test>
diff --git a/test/testcases/tests/level1/html/HTMLCollection02.xml.kfail b/test/testcases/tests/level1/html/HTMLCollection05.xml.kfail
index 521d5ae..ffb7d13 100644
--- a/test/testcases/tests/level1/html/HTMLCollection02.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLCollection05.xml.kfail
@@ -16,34 +16,31 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-->
<!DOCTYPE test SYSTEM "dom1.dtd">
-<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLCollection02">
+<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLCollection05">
<metadata>
-<title>HTMLCollection02</title>
+<title>HTMLCollection05</title>
<creator>NIST</creator>
<description>
- An individual node may be accessed by either ordinal index, the node's
- name or id attributes. (Test node name).
+ The length attribute specifies the length or size of the list.
- Retrieve the first FORM element and create a HTMLCollection by invoking
- the elements attribute. The first SELECT element is further retrieved
- using the elements name attribute.
+ Retrieve the first TABLE element and create a HTMLCollection by invoking
+ the "rows" attribute. Retrieve the length attribute of the HTMLCollection
+ object.
</description>
<contributor>Rick Rivello</contributor>
<date qualifier="created">2002-05-01</date>
-<subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479"/>
+<subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551"/>
</metadata>
<var name="nodeList" type="NodeList"/>
<var name="testNode" type="Node"/>
-<var name="formNode" type="Node"/>
-<var name="formsnodeList" type="HTMLCollection"/>
-<var name="vname" type="DOMString" />
+<var name="rowsnodeList" type="HTMLCollection"/>
+<var name="rowLength" type="int" />
<var name="doc" type="Document"/>
<load var="doc" href="collection" willBeModified="false"/>
-<getElementsByTagName interface="Document" obj="doc" var="nodeList" tagname='"form"'/>
+<getElementsByTagName interface="Document" obj="doc" var="nodeList" tagname='"table"'/>
<assertSize collection="nodeList" size="1" id="Asize"/>
<item interface="NodeList" obj="nodeList" var="testNode" index="0"/>
-<elements interface="HTMLFormElement" obj="testNode" var="formsnodeList"/>
-<namedItem obj="formsnodeList" var="formNode" name='"select1"'/>
-<nodeName obj="formNode" var="vname"/>
-<assertEquals actual="vname" expected='"SELECT"' id="nameIndexLink" ignoreCase="auto"/>
+<rows interface="HTMLTableElement" obj="testNode" var="rowsnodeList"/>
+<length interface="HTMLCollection" obj="rowsnodeList" var="rowLength"/>
+<assertEquals actual="rowLength" expected="4" id="rowIndexLink" ignoreCase="false"/>
</test>
diff --git a/test/testcases/tests/level1/html/HTMLCollection01.xml.notimpl b/test/testcases/tests/level1/html/HTMLCollection09.xml.kfail
index fd2cfe4..f81e7af 100644
--- a/test/testcases/tests/level1/html/HTMLCollection01.xml.notimpl
+++ b/test/testcases/tests/level1/html/HTMLCollection09.xml.kfail
@@ -16,17 +16,16 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-->
<!DOCTYPE test SYSTEM "dom1.dtd">
-<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLCollection01">
+<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLCollection09">
<metadata>
-<title>HTMLCollection01</title>
+<title>HTMLCollection09</title>
<creator>NIST</creator>
<description>
- An individual node may be accessed by either ordinal index, the node's
- name or id attributes. (Test ordinal index).
+ The item(index) method returns null if the index is out of range.
Retrieve the first TABLE element and create a HTMLCollection by invoking
- the "rows" attribute. The item located at ordinal index 0 is further
- retrieved and its "rowIndex" attribute is examined.
+ the "rows" attribute. Invoke the item(index) method with an index
+ of 5. This index is out of range and should return null.
</description>
<contributor>Rick Rivello</contributor>
<date qualifier="created">2002-05-01</date>
@@ -43,7 +42,6 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
<assertSize collection="nodeList" size="1" id="Asize"/>
<item interface="NodeList" obj="nodeList" var="testNode" index="0"/>
<rows interface="HTMLTableElement" obj="testNode" var="rowsnodeList"/>
-<item interface="HTMLCollection" obj="rowsnodeList" var="rowNode" index="0"/>
-<rowIndex interface="HTMLTableRowElement" obj="rowNode" var="vrowindex"/>
-<assertEquals actual="vrowindex" expected="0" id="rowIndexLink" ignoreCase="false"/>
+<item interface="HTMLCollection" obj="rowsnodeList" var="rowNode" index="5"/>
+<assertNull actual="rowNode" id="rowIndexLink"/>
</test>
diff --git a/test/testcases/tests/level1/html/HTMLCollection03.xml.kfail b/test/testcases/tests/level1/html/HTMLCollection12.xml.kfail
index 36d489e..d7feb3d 100644
--- a/test/testcases/tests/level1/html/HTMLCollection03.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLCollection12.xml.kfail
@@ -16,17 +16,20 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-->
<!DOCTYPE test SYSTEM "dom1.dtd">
-<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLCollection03">
+<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLCollection12">
<metadata>
-<title>HTMLCollection03</title>
+<title>HTMLCollection12</title>
<creator>NIST</creator>
<description>
- An individual node may be accessed by either ordinal index, the node's
- name or id attributes. (Test id attribute).
+ The namedItem(name) method retrieves a node using a name. It first
+ searches for a node with a matching id attribute. If it doesn't find
+ one, it then searches for a Node with a matching name attribute, but only
+ on those elements that are allowed a name attribute. If there isn't
+ a matching node the method returns null.
Retrieve the first FORM element and create a HTMLCollection by invoking
- the "element" attribute. The first SELECT element is further retrieved
- using the elements id.
+ the elements attribute. The method returns null since there is not a
+ match of the name or id attribute.
</description>
<contributor>Rick Rivello</contributor>
<date qualifier="created">2002-05-01</date>
@@ -36,14 +39,12 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
<var name="testNode" type="Node"/>
<var name="formNode" type="Node"/>
<var name="formsnodeList" type="HTMLCollection"/>
-<var name="vname" type="DOMString" />
<var name="doc" type="Document"/>
<load var="doc" href="collection" willBeModified="false"/>
<getElementsByTagName interface="Document" obj="doc" var="nodeList" tagname='"form"'/>
<assertSize collection="nodeList" size="1" id="Asize"/>
<item interface="NodeList" obj="nodeList" var="testNode" index="0"/>
<elements interface="HTMLFormElement" obj="testNode" var="formsnodeList"/>
-<namedItem obj="formsnodeList" var="formNode" name='"selectId"'/>
-<nodeName obj="formNode" var="vname"/>
-<assertEquals actual="vname" expected='"select"' id="nameIndexLink" ignoreCase="auto"/>
+<namedItem obj="formsnodeList" var="formNode" name='"select9"'/>
+<assertNull actual="formNode" id="nameIndexLink" />
</test>
diff --git a/test/testcases/tests/level1/html/HTMLTableElement01.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement01.xml
index 7135fd7..7135fd7 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement01.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement01.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement02.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement02.xml
index fb9fa8f..fb9fa8f 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement02.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement02.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement03.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement03.xml
index 0b59fe6..0b59fe6 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement03.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement03.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement04.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement04.xml
index 1e254b3..1e254b3 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement04.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement04.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement05.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement05.xml
index 15de11c..15de11c 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement05.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement05.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement06.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement06.xml
index e18b8f8..e18b8f8 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement06.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement06.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement07.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement07.xml
index 44be1c3..44be1c3 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement07.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement07.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement08.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement08.xml
index 1a744b1..1a744b1 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement08.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement08.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement09.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement09.xml
index a0aecf3..a0aecf3 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement09.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement09.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement10.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement10.xml
index 160afeb..160afeb 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement10.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement10.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement11.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement11.xml
index 785c4d0..785c4d0 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement11.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement11.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement12.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement12.xml
index 811a147..811a147 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement12.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement12.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement13.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement13.xml
index 4a18d8d..4a18d8d 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement13.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement13.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement14.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement14.xml
index 478e9c9..478e9c9 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement14.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement14.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement15.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement15.xml
index 51f9763..51f9763 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement15.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement15.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement16.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement16.xml
index 7166437..7166437 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement16.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement16.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement17.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement17.xml
index 9337c09..9337c09 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement17.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement17.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement18.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement18.xml
index 210e2b1..210e2b1 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement18.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement18.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement19.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement19.xml
index 152174d..152174d 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement19.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement19.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement20.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement20.xml
index 032725b..032725b 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement20.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement20.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement21.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement21.xml.kfail
index 3903b69..b50a007 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement21.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement21.xml.kfail
@@ -35,8 +35,8 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
<var name="nodeList" type="NodeList"/>
<var name="rowsnodeList" type="HTMLCollection"/>
<var name="testNode" type="Node"/>
-<var name="vsection1" type="HTMLTableElement" />
-<var name="vsection2" type="HTMLTableElement" />
+<var name="vsection1" type="HTMLTableSectionElement" />
+<var name="vsection2" type="HTMLTableSectionElement" />
<var name="vrows" type="int"/>
<var name="doc" type="Document"/>
<var name="result" type="List"/>
diff --git a/test/testcases/tests/level1/html/HTMLTableElement22.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement22.xml
index 6649b0f..6649b0f 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement22.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement22.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement23.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement23.xml
index 1f53f03..1f53f03 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement23.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement23.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement24.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement24.xml.kfail
index d6f993c..58af66e 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement24.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement24.xml.kfail
@@ -35,8 +35,8 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
<var name="nodeList" type="NodeList"/>
<var name="rowsnodeList" type="HTMLCollection"/>
<var name="testNode" type="Node"/>
-<var name="vsection1" type="HTMLTableElement" />
-<var name="vsection2" type="HTMLTableElement" />
+<var name="vsection1" type="HTMLTableSectionElement" />
+<var name="vsection2" type="HTMLTableSectionElement" />
<var name="vrows" type="int"/>
<var name="doc" type="Document"/>
<var name="result" type="List"/>
diff --git a/test/testcases/tests/level1/html/HTMLTableElement25.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement25.xml
index a28ae65..a28ae65 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement25.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement25.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement26.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement26.xml
index 5517f2f..5517f2f 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement26.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement26.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableElement27.xml.kfail b/test/testcases/tests/level1/html/HTMLTableElement27.xml
index c387d69..c387d69 100644
--- a/test/testcases/tests/level1/html/HTMLTableElement27.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableElement27.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement01.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement01.xml
index 0dbd008..0dbd008 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement01.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement01.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement02.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement02.xml
index 284bc84..284bc84 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement02.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement02.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement03.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement03.xml
index 341c2a5..341c2a5 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement03.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement03.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement04.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement04.xml
index bca05d4..bca05d4 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement04.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement04.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement06.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement06.xml
index 55fc2ac..55fc2ac 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement06.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement06.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement07.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement07.xml
index c586f6a..c586f6a 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement07.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement07.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement08.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement08.xml
index 751ef9e..751ef9e 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement08.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement08.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement09.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement09.xml
index eda033b..eda033b 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement09.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement09.xml
diff --git a/test/testcases/tests/level1/html/HTMLTableRowElement10.xml.kfail b/test/testcases/tests/level1/html/HTMLTableRowElement10.xml
index 3554fb6..3554fb6 100644
--- a/test/testcases/tests/level1/html/HTMLTableRowElement10.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLTableRowElement10.xml
diff --git a/test/testcases/tests/level1/html/anchor01.xml.notimpl b/test/testcases/tests/level1/html/anchor01.xml
index 19a2711..19a2711 100644
--- a/test/testcases/tests/level1/html/anchor01.xml.notimpl
+++ b/test/testcases/tests/level1/html/anchor01.xml
diff --git a/test/testcases/tests/level1/html/anchor02.xml.notimpl b/test/testcases/tests/level1/html/anchor02.xml
index 61486a7..61486a7 100644
--- a/test/testcases/tests/level1/html/anchor02.xml.notimpl
+++ b/test/testcases/tests/level1/html/anchor02.xml
diff --git a/test/testcases/tests/level1/html/anchor03.xml.notimpl b/test/testcases/tests/level1/html/anchor03.xml
index e6bd32e..e6bd32e 100644
--- a/test/testcases/tests/level1/html/anchor03.xml.notimpl
+++ b/test/testcases/tests/level1/html/anchor03.xml
diff --git a/test/testcases/tests/level1/html/anchor04.xml.notimpl b/test/testcases/tests/level1/html/anchor04.xml.kfail
index b5ce201..b5ce201 100644
--- a/test/testcases/tests/level1/html/anchor04.xml.notimpl
+++ b/test/testcases/tests/level1/html/anchor04.xml.kfail
diff --git a/test/testcases/tests/level1/html/anchor05.xml.notimpl b/test/testcases/tests/level1/html/anchor05.xml
index 27b34ac..27b34ac 100644
--- a/test/testcases/tests/level1/html/anchor05.xml.notimpl
+++ b/test/testcases/tests/level1/html/anchor05.xml
diff --git a/test/testcases/tests/level1/html/anchor06.xml.notimpl b/test/testcases/tests/level1/html/anchor06.xml
index 31190be..31190be 100644
--- a/test/testcases/tests/level1/html/anchor06.xml.notimpl
+++ b/test/testcases/tests/level1/html/anchor06.xml
diff --git a/test/testcases/tests/level1/html/dlist01.xml.notimpl b/test/testcases/tests/level1/html/dlist01.xml
index 35cbe2c..35cbe2c 100644
--- a/test/testcases/tests/level1/html/dlist01.xml.notimpl
+++ b/test/testcases/tests/level1/html/dlist01.xml
diff --git a/test/testcases/tests/level1/html/table01.xml.kfail b/test/testcases/tests/level1/html/table01.xml
index 4cee6f7..4cee6f7 100644
--- a/test/testcases/tests/level1/html/table01.xml.kfail
+++ b/test/testcases/tests/level1/html/table01.xml
diff --git a/test/testcases/tests/level1/html/table02.xml.kfail b/test/testcases/tests/level1/html/table02.xml
index 2433751..2433751 100644
--- a/test/testcases/tests/level1/html/table02.xml.kfail
+++ b/test/testcases/tests/level1/html/table02.xml
diff --git a/test/testcases/tests/level1/html/table03.xml.kfail b/test/testcases/tests/level1/html/table03.xml
index b8c3ef6..b8c3ef6 100644
--- a/test/testcases/tests/level1/html/table03.xml.kfail
+++ b/test/testcases/tests/level1/html/table03.xml
diff --git a/test/testcases/tests/level1/html/table04.xml.kfail b/test/testcases/tests/level1/html/table04.xml
index 2d4fcf8..2d4fcf8 100644
--- a/test/testcases/tests/level1/html/table04.xml.kfail
+++ b/test/testcases/tests/level1/html/table04.xml
diff --git a/test/testcases/tests/level1/html/table08.xml.kfail b/test/testcases/tests/level1/html/table08.xml
index ea77b80..ea77b80 100644
--- a/test/testcases/tests/level1/html/table08.xml.kfail
+++ b/test/testcases/tests/level1/html/table08.xml
diff --git a/test/testcases/tests/level1/html/table09.xml.kfail b/test/testcases/tests/level1/html/table09.xml
index fcb9018..fcb9018 100644
--- a/test/testcases/tests/level1/html/table09.xml.kfail
+++ b/test/testcases/tests/level1/html/table09.xml
diff --git a/test/testcases/tests/level1/html/table10.xml.kfail b/test/testcases/tests/level1/html/table10.xml
index aa05594..aa05594 100644
--- a/test/testcases/tests/level1/html/table10.xml.kfail
+++ b/test/testcases/tests/level1/html/table10.xml
diff --git a/test/testcases/tests/level1/html/table12.xml.kfail b/test/testcases/tests/level1/html/table12.xml
index 93e475b..93e475b 100644
--- a/test/testcases/tests/level1/html/table12.xml.kfail
+++ b/test/testcases/tests/level1/html/table12.xml
diff --git a/test/testcases/tests/level1/html/table17.xml.kfail b/test/testcases/tests/level1/html/table17.xml
index 7223562..7223562 100644
--- a/test/testcases/tests/level1/html/table17.xml.kfail
+++ b/test/testcases/tests/level1/html/table17.xml
diff --git a/test/testcases/tests/level1/html/table18.xml.kfail b/test/testcases/tests/level1/html/table18.xml
index db8c161..db8c161 100644
--- a/test/testcases/tests/level1/html/table18.xml.kfail
+++ b/test/testcases/tests/level1/html/table18.xml
diff --git a/test/testcases/tests/level1/html/table19.xml.kfail b/test/testcases/tests/level1/html/table19.xml
index e88be88..e88be88 100644
--- a/test/testcases/tests/level1/html/table19.xml.kfail
+++ b/test/testcases/tests/level1/html/table19.xml
diff --git a/test/testcases/tests/level1/html/table20.xml.kfail b/test/testcases/tests/level1/html/table20.xml
index 2205987..2205987 100644
--- a/test/testcases/tests/level1/html/table20.xml.kfail
+++ b/test/testcases/tests/level1/html/table20.xml
diff --git a/test/testcases/tests/level1/html/table21.xml.kfail b/test/testcases/tests/level1/html/table21.xml
index fa22103..fa22103 100644
--- a/test/testcases/tests/level1/html/table21.xml.kfail
+++ b/test/testcases/tests/level1/html/table21.xml
diff --git a/test/testcases/tests/level1/html/table22.xml.kfail b/test/testcases/tests/level1/html/table22.xml
index 7c097b4..7c097b4 100644
--- a/test/testcases/tests/level1/html/table22.xml.kfail
+++ b/test/testcases/tests/level1/html/table22.xml
diff --git a/test/testcases/tests/level1/html/table23.xml.kfail b/test/testcases/tests/level1/html/table23.xml
index 4ea8ace..4ea8ace 100644
--- a/test/testcases/tests/level1/html/table23.xml.kfail
+++ b/test/testcases/tests/level1/html/table23.xml
diff --git a/test/testcases/tests/level1/html/table24.xml.kfail b/test/testcases/tests/level1/html/table24.xml
index 7606917..7606917 100644
--- a/test/testcases/tests/level1/html/table24.xml.kfail
+++ b/test/testcases/tests/level1/html/table24.xml
diff --git a/test/testcases/tests/level1/html/table25.xml.kfail b/test/testcases/tests/level1/html/table25.xml
index b8e10dd..b8e10dd 100644
--- a/test/testcases/tests/level1/html/table25.xml.kfail
+++ b/test/testcases/tests/level1/html/table25.xml
diff --git a/test/testcases/tests/level1/html/table26.xml.kfail b/test/testcases/tests/level1/html/table26.xml
index 9f09d4f..9f09d4f 100644
--- a/test/testcases/tests/level1/html/table26.xml.kfail
+++ b/test/testcases/tests/level1/html/table26.xml
diff --git a/test/testcases/tests/level1/html/table27.xml.kfail b/test/testcases/tests/level1/html/table27.xml
index e0dc78d..e0dc78d 100644
--- a/test/testcases/tests/level1/html/table27.xml.kfail
+++ b/test/testcases/tests/level1/html/table27.xml
diff --git a/test/testcases/tests/level1/html/table28.xml.kfail b/test/testcases/tests/level1/html/table28.xml
index d445a1c..d445a1c 100644
--- a/test/testcases/tests/level1/html/table28.xml.kfail
+++ b/test/testcases/tests/level1/html/table28.xml
diff --git a/test/testcases/tests/level1/html/table29.xml.kfail b/test/testcases/tests/level1/html/table29.xml
index ae483d4..ae483d4 100644
--- a/test/testcases/tests/level1/html/table29.xml.kfail
+++ b/test/testcases/tests/level1/html/table29.xml
diff --git a/test/testcases/tests/level1/html/table30.xml.kfail b/test/testcases/tests/level1/html/table30.xml
index 837be29..837be29 100644
--- a/test/testcases/tests/level1/html/table30.xml.kfail
+++ b/test/testcases/tests/level1/html/table30.xml
diff --git a/test/testcases/tests/level1/html/table31.xml.kfail b/test/testcases/tests/level1/html/table31.xml
index f5c3fa6..f5c3fa6 100644
--- a/test/testcases/tests/level1/html/table31.xml.kfail
+++ b/test/testcases/tests/level1/html/table31.xml
diff --git a/test/testcases/tests/level1/html/table32.xml.kfail b/test/testcases/tests/level1/html/table32.xml
index cf7e0cd..cf7e0cd 100644
--- a/test/testcases/tests/level1/html/table32.xml.kfail
+++ b/test/testcases/tests/level1/html/table32.xml
diff --git a/test/testcases/tests/level1/html/table33.xml.kfail b/test/testcases/tests/level1/html/table33.xml
index 5c0e447..5c0e447 100644
--- a/test/testcases/tests/level1/html/table33.xml.kfail
+++ b/test/testcases/tests/level1/html/table33.xml
diff --git a/test/testcases/tests/level1/html/table34.xml.kfail b/test/testcases/tests/level1/html/table34.xml
index 07443ef..07443ef 100644
--- a/test/testcases/tests/level1/html/table34.xml.kfail
+++ b/test/testcases/tests/level1/html/table34.xml
diff --git a/test/testcases/tests/level1/html/table35.xml.kfail b/test/testcases/tests/level1/html/table35.xml
index 32cce60..32cce60 100644
--- a/test/testcases/tests/level1/html/table35.xml.kfail
+++ b/test/testcases/tests/level1/html/table35.xml
diff --git a/test/testcases/tests/level1/html/table36.xml.kfail b/test/testcases/tests/level1/html/table36.xml
index 2bdded8..2bdded8 100644
--- a/test/testcases/tests/level1/html/table36.xml.kfail
+++ b/test/testcases/tests/level1/html/table36.xml
diff --git a/test/testcases/tests/level1/html/table37.xml.kfail b/test/testcases/tests/level1/html/table37.xml
index cdf5b73..cdf5b73 100644
--- a/test/testcases/tests/level1/html/table37.xml.kfail
+++ b/test/testcases/tests/level1/html/table37.xml
diff --git a/test/testcases/tests/level1/html/table38.xml.kfail b/test/testcases/tests/level1/html/table38.xml
index fad8dfe..fad8dfe 100644
--- a/test/testcases/tests/level1/html/table38.xml.kfail
+++ b/test/testcases/tests/level1/html/table38.xml
diff --git a/test/testcases/tests/level1/html/table39.xml.kfail b/test/testcases/tests/level1/html/table39.xml
index 1fd66db..1fd66db 100644
--- a/test/testcases/tests/level1/html/table39.xml.kfail
+++ b/test/testcases/tests/level1/html/table39.xml
diff --git a/test/testcases/tests/level1/html/table40.xml.kfail b/test/testcases/tests/level1/html/table40.xml
index 31a9763..31a9763 100644
--- a/test/testcases/tests/level1/html/table40.xml.kfail
+++ b/test/testcases/tests/level1/html/table40.xml
diff --git a/test/testcases/tests/level1/html/table41.xml.kfail b/test/testcases/tests/level1/html/table41.xml
index 4030b09..4030b09 100644
--- a/test/testcases/tests/level1/html/table41.xml.kfail
+++ b/test/testcases/tests/level1/html/table41.xml
diff --git a/test/testcases/tests/level1/html/table42.xml.kfail b/test/testcases/tests/level1/html/table42.xml
index 8fa86f1..8fa86f1 100644
--- a/test/testcases/tests/level1/html/table42.xml.kfail
+++ b/test/testcases/tests/level1/html/table42.xml
diff --git a/test/testcases/tests/level1/html/table43.xml.kfail b/test/testcases/tests/level1/html/table43.xml
index ea9e5de..ea9e5de 100644
--- a/test/testcases/tests/level1/html/table43.xml.kfail
+++ b/test/testcases/tests/level1/html/table43.xml
diff --git a/test/testcases/tests/level1/html/table44.xml.kfail b/test/testcases/tests/level1/html/table44.xml
index a893f76..a893f76 100644
--- a/test/testcases/tests/level1/html/table44.xml.kfail
+++ b/test/testcases/tests/level1/html/table44.xml
diff --git a/test/testcases/tests/level1/html/table45.xml.kfail b/test/testcases/tests/level1/html/table45.xml
index b1717db..b1717db 100644
--- a/test/testcases/tests/level1/html/table45.xml.kfail
+++ b/test/testcases/tests/level1/html/table45.xml
diff --git a/test/testcases/tests/level1/html/table46.xml.kfail b/test/testcases/tests/level1/html/table46.xml
index 096b892..096b892 100644
--- a/test/testcases/tests/level1/html/table46.xml.kfail
+++ b/test/testcases/tests/level1/html/table46.xml
diff --git a/test/testcases/tests/level1/html/table47.xml.kfail b/test/testcases/tests/level1/html/table47.xml
index 4d8340b..4d8340b 100644
--- a/test/testcases/tests/level1/html/table47.xml.kfail
+++ b/test/testcases/tests/level1/html/table47.xml
diff --git a/test/testcases/tests/level1/html/table48.xml.kfail b/test/testcases/tests/level1/html/table48.xml
index 1910883..1910883 100644
--- a/test/testcases/tests/level1/html/table48.xml.kfail
+++ b/test/testcases/tests/level1/html/table48.xml
diff --git a/test/testcases/tests/level1/html/table49.xml.kfail b/test/testcases/tests/level1/html/table49.xml
index 1db690b..1db690b 100644
--- a/test/testcases/tests/level1/html/table49.xml.kfail
+++ b/test/testcases/tests/level1/html/table49.xml
diff --git a/test/testcases/tests/level1/html/table50.xml.kfail b/test/testcases/tests/level1/html/table50.xml
index 8f60638..8f60638 100644
--- a/test/testcases/tests/level1/html/table50.xml.kfail
+++ b/test/testcases/tests/level1/html/table50.xml
diff --git a/test/testcases/tests/level1/html/table51.xml.kfail b/test/testcases/tests/level1/html/table51.xml
index c917f27..c917f27 100644
--- a/test/testcases/tests/level1/html/table51.xml.kfail
+++ b/test/testcases/tests/level1/html/table51.xml
diff --git a/test/testcases/tests/level1/html/table52.xml.kfail b/test/testcases/tests/level1/html/table52.xml
index bf94572..bf94572 100644
--- a/test/testcases/tests/level1/html/table52.xml.kfail
+++ b/test/testcases/tests/level1/html/table52.xml
diff --git a/test/testcases/tests/level1/html/table53.xml.kfail b/test/testcases/tests/level1/html/table53.xml
index 210c7e1..210c7e1 100644
--- a/test/testcases/tests/level1/html/table53.xml.kfail
+++ b/test/testcases/tests/level1/html/table53.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableElement34.xml.kfail b/test/testcases/tests/level2/html/HTMLTableElement34.xml
index d774498..d774498 100644
--- a/test/testcases/tests/level2/html/HTMLTableElement34.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableElement34.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableElement35.xml.kfail b/test/testcases/tests/level2/html/HTMLTableElement35.xml
index 6410e89..6410e89 100644
--- a/test/testcases/tests/level2/html/HTMLTableElement35.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableElement35.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableElement36.xml.kfail b/test/testcases/tests/level2/html/HTMLTableElement36.xml
index 7a514e5..7a514e5 100644
--- a/test/testcases/tests/level2/html/HTMLTableElement36.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableElement36.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableElement37.xml.kfail b/test/testcases/tests/level2/html/HTMLTableElement37.xml
index 097deb1..097deb1 100644
--- a/test/testcases/tests/level2/html/HTMLTableElement37.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableElement37.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableElement38.xml.kfail b/test/testcases/tests/level2/html/HTMLTableElement38.xml
index 0f5bccd..0f5bccd 100644
--- a/test/testcases/tests/level2/html/HTMLTableElement38.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableElement38.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableElement39.xml.kfail b/test/testcases/tests/level2/html/HTMLTableElement39.xml.kfail
index 6631584..0a6fcfd 100644
--- a/test/testcases/tests/level2/html/HTMLTableElement39.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableElement39.xml.kfail
@@ -54,9 +54,14 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details.
<length interface="HTMLCollection" obj="rowsnodeList" var="vrows"/>
<assertEquals actual="vrows" expected="2" id="rowsLink1" ignoreCase="false"/>
<insertRow interface="HTMLTableElement" obj="testNode" var="newRow" index="-1"/>
+<!--
+* the following assumes that the row is appended to tbody
+* this is obviously wrong it should be appended to tfoot which is the end
+* of the table
<tBodies interface="HTMLTableElement" obj="testNode" var="tbodiesnodeList"/>
<item interface="HTMLCollection" obj="tbodiesnodeList" var="bodyNode" index="0"/>
<rows interface="HTMLTableSectionElement" obj="bodyNode" var="rowsnodeList"/>
<length interface="HTMLCollection" obj="rowsnodeList" var="vrows"/>
<assertEquals actual="vrows" expected="3" id="rowsLink2" ignoreCase="false"/>
+--!>
</test>
diff --git a/test/testcases/tests/level2/html/HTMLTableRowElement15.xml.kfail b/test/testcases/tests/level2/html/HTMLTableRowElement15.xml
index 9e89674..9e89674 100644
--- a/test/testcases/tests/level2/html/HTMLTableRowElement15.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableRowElement15.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableRowElement16.xml.kfail b/test/testcases/tests/level2/html/HTMLTableRowElement16.xml
index 8471a2b..8471a2b 100644
--- a/test/testcases/tests/level2/html/HTMLTableRowElement16.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableRowElement16.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableRowElement17.xml.kfail b/test/testcases/tests/level2/html/HTMLTableRowElement17.xml
index b469470..b469470 100644
--- a/test/testcases/tests/level2/html/HTMLTableRowElement17.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableRowElement17.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableRowElement18.xml.kfail b/test/testcases/tests/level2/html/HTMLTableRowElement18.xml
index f296086..f296086 100644
--- a/test/testcases/tests/level2/html/HTMLTableRowElement18.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableRowElement18.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableRowElement19.xml.kfail b/test/testcases/tests/level2/html/HTMLTableRowElement19.xml
index 9a111f3..9a111f3 100644
--- a/test/testcases/tests/level2/html/HTMLTableRowElement19.xml.kfail
+++ b/test/testcases/tests/level2/html/HTMLTableRowElement19.xml
diff --git a/test/testcases/tests/level2/html/HTMLTableSectionElement30.xml.kfail b/test/testcases/tests/level2/html/HTMLTableSectionElement30.xml.kfail
new file mode 100644
index 0000000..8fd17c2
--- a/dev/null
+++ b/test/testcases/tests/level2/html/HTMLTableSectionElement30.xml.kfail
@@ -0,0 +1,55 @@
+<?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
new file mode 100644
index 0000000..55464e2
--- a/dev/null
+++ b/test/testcases/tests/level2/html/HTMLTableSectionElement31.xml.kfail
@@ -0,0 +1,53 @@
+<?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/table.html b/test/testcases/tests/level2/html/files/table.html
new file mode 100644
index 0000000..b8f151e
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/table.html
@@ -0,0 +1,78 @@
+<!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 - TABLE</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE ALIGN="center" SUMMARY="Table 1">
+<TR>
+<TH>Id</TH>
+<TH>Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+</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">
+<TR ALIGN="center" BGCOLOR="#00FFFF" VALIGN="middle">
+<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">
+<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">
+<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>
+<TABLE SUMMARY="Table 3">
+<TBODY>
+<TR>
+<TD>
+</TD>
+</TR>
+</TBODY>
+<TBODY>
+<TR>
+<TD>
+</TD>
+</TR>
+</TBODY>
+<TBODY>
+<TR>
+<TD>
+</TD>
+</TR>
+</TBODY>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/test/testcases/tests/level2/html/files/table.xhtml b/test/testcases/tests/level2/html/files/table.xhtml
new file mode 100644
index 0000000..8300b90
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/table.xhtml
@@ -0,0 +1,81 @@
+<?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 - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</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">
+<tr align="center" bgcolor="#00FFFF" valign="middle">
+<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">
+<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">
+<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>
+<table summary="Table 3">
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
diff --git a/test/testcases/tests/level2/html/files/table.xml b/test/testcases/tests/level2/html/files/table.xml
new file mode 100644
index 0000000..8300b90
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/table.xml
@@ -0,0 +1,81 @@
+<?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 - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</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">
+<tr align="center" bgcolor="#00FFFF" valign="middle">
+<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">
+<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">
+<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>
+<table summary="Table 3">
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+<tbody>
+<tr>
+<td>
+</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+
diff --git a/test/testcases/tests/level2/html/files/table1.html b/test/testcases/tests/level2/html/files/table1.html
new file mode 100644
index 0000000..8f5d19b
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/table1.html
@@ -0,0 +1,12 @@
+<!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 - TABLE</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE SUMMARY="Empty Table">
+<tr><td>HTML can't abide empty table</td></tr>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/test/testcases/tests/level2/html/files/table1.xhtml b/test/testcases/tests/level2/html/files/table1.xhtml
new file mode 100644
index 0000000..e174c63
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/table1.xhtml
@@ -0,0 +1,15 @@
+<?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 - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Empty Table">
+<tr><td>XHTML can't abide empty table</td></tr>
+</table>
+</body>
+</html>
+
diff --git a/test/testcases/tests/level2/html/files/table1.xml b/test/testcases/tests/level2/html/files/table1.xml
new file mode 100644
index 0000000..e174c63
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/table1.xml
@@ -0,0 +1,15 @@
+<?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 - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table summary="Empty Table">
+<tr><td>XHTML can't abide empty table</td></tr>
+</table>
+</body>
+</html>
+
diff --git a/test/testcases/tests/level2/html/files/tablerow.html b/test/testcases/tests/level2/html/files/tablerow.html
new file mode 100644
index 0000000..9e76a4c
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/tablerow.html
@@ -0,0 +1,59 @@
+<!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 - TABLEROW</TITLE>
+</HEAD>
+<BODY onload="parent.loadComplete()">
+<TABLE ALIGN="center" SUMMARY="Table 1">
+<TR>
+<TH>Id</TH>
+<TH>Name</TH>
+<TH>Position</TH>
+<TH>Salary</TH>
+</TR>
+</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">
+<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">
+<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">
+<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/tablerow.xhtml b/test/testcases/tests/level2/html/files/tablerow.xhtml
new file mode 100644
index 0000000..b901e3c
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/tablerow.xhtml
@@ -0,0 +1,62 @@
+<?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 - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</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">
+<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">
+<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">
+<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/tablerow.xml b/test/testcases/tests/level2/html/files/tablerow.xml
new file mode 100644
index 0000000..b901e3c
--- a/dev/null
+++ b/test/testcases/tests/level2/html/files/tablerow.xml
@@ -0,0 +1,62 @@
+<?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 - TABLE</title>
+</head>
+<body onload="parent.loadComplete()">
+<table align="center" summary="Table 1">
+<tr>
+<th>Id</th>
+<th>Name</th>
+<th>Position</th>
+<th>Salary</th>
+</tr>
+</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">
+<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">
+<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">
+<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/testutils/domtsasserts.c b/test/testutils/domtsasserts.c
index 41cacf2..cbb8ed0 100644
--- a/test/testutils/domtsasserts.c
+++ b/test/testutils/domtsasserts.c
@@ -124,7 +124,10 @@ bool is_equals_list(list *expected, list *actual, bool ignoreCase)
comparator rcmp = NULL;
if (expected->type == INT)
+ {
cmp = int_comparator;
+ rcmp = int_comparator;
+ }
if (expected->type == STRING) {
if (actual->type == DOM_STRING) {
cmp = ignoreCase? str_icmp : str_cmp;
@@ -139,6 +142,7 @@ bool is_equals_list(list *expected, list *actual, bool ignoreCase)
}
assert(cmp != NULL);
+ assert(rcmp != NULL);
return list_contains_all(expected, actual, cmp) && list_contains_all(actual, expected, rcmp);
}