summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsk1994 <rsk1coder99@gmail.com>2014-05-02 03:12:01 (GMT)
committer Rupinder Singh Khokhar <rsk1coder99@gmail.com>2014-06-10 22:56:37 (GMT)
commit7d2a3a352e8deeef4cbd1da03b8eb6ff113054b6 (patch)
tree187b850c6c4869d39e6e8e00a4ac5b25d9ac9afb
parent8f3e2dcd42ba26122dd3f20d0c1e1984c27b7fd0 (diff)
downloadlibdom-7d2a3a352e8deeef4cbd1da03b8eb6ff113054b6.tar.gz
libdom-7d2a3a352e8deeef4cbd1da03b8eb6ff113054b6.tar.bz2
Fieldset & Legend Elements
-rw-r--r--Makefile2
-rw-r--r--include/dom/dom.h2
-rw-r--r--include/dom/html/html_fieldset_element.h17
-rw-r--r--include/dom/html/html_legend_element.h27
-rw-r--r--src/html/Makefile6
-rw-r--r--src/html/TODO4
-rw-r--r--src/html/html_document.c8
-rw-r--r--src/html/html_fieldset_element.c146
-rw-r--r--src/html/html_fieldset_element.h46
-rw-r--r--src/html/html_form_element.c2
-rw-r--r--src/html/html_legend_element.c208
-rw-r--r--src/html/html_legend_element.h46
-rw-r--r--test/testcases/tests/level1/html/HTMLFieldSetElement01.xml (renamed from test/testcases/tests/level1/html/HTMLFieldSetElement01.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLFieldSetElement02.xml (renamed from test/testcases/tests/level1/html/HTMLFieldSetElement02.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLLegendElement01.xml (renamed from test/testcases/tests/level1/html/HTMLLegendElement01.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLLegendElement02.xml (renamed from test/testcases/tests/level1/html/HTMLLegendElement02.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLLegendElement03.xml (renamed from test/testcases/tests/level1/html/HTMLLegendElement03.xml.kfail)0
-rw-r--r--test/testcases/tests/level1/html/HTMLLegendElement04.xml (renamed from test/testcases/tests/level1/html/HTMLLegendElement04.xml.kfail)0
18 files changed, 508 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 19c239f..950a560 100644
--- a/Makefile
+++ b/Makefile
@@ -100,6 +100,8 @@ INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_hr_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_dlist_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_directory_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_menu_element.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_fieldset_element.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_legend_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 38bb996..fb5e2f1 100644
--- a/include/dom/dom.h
+++ b/include/dom/dom.h
@@ -59,6 +59,8 @@
#include <dom/html/html_dlist_element.h>
#include <dom/html/html_directory_element.h>
#include <dom/html/html_menu_element.h>
+#include <dom/html/html_fieldset_element.h>
+#include <dom/html/html_legend_element.h>
/* DOM Events header */
#include <dom/events/events.h>
diff --git a/include/dom/html/html_fieldset_element.h b/include/dom/html/html_fieldset_element.h
index 2e182d5..26383b3 100644
--- a/include/dom/html/html_fieldset_element.h
+++ b/include/dom/html/html_fieldset_element.h
@@ -3,5 +3,22 @@
* 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_field_set_element_h_
+#define dom_html_field_set_element_h_
+
+#include <stdbool.h>
+
+#include <dom/core/exceptions.h>
+
+#include <dom/html/html_form_element.h>
+
+typedef struct dom_html_field_set_element dom_html_field_set_element;
+
+struct dom_html_element;
+dom_exception dom_html_field_set_element_get_form(
+ dom_html_field_set_element *ele, dom_html_form_element **form);
+#endif
+
diff --git a/include/dom/html/html_legend_element.h b/include/dom/html/html_legend_element.h
index 2e182d5..caf34a6 100644
--- a/include/dom/html/html_legend_element.h
+++ b/include/dom/html/html_legend_element.h
@@ -3,5 +3,32 @@
* 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_legend_element_h_
+#define dom_html_legend_element_h_
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+#include <dom/core/string.h>
+
+#include <dom/html/html_form_element.h>
+
+typedef struct dom_html_legend_element dom_html_legend_element;
+
+dom_exception dom_html_legend_element_get_form(
+ dom_html_legend_element *ele, dom_html_form_element **form);
+
+dom_exception dom_html_legend_element_get_access_key(
+ dom_html_legend_element *element, dom_string **access_key);
+
+dom_exception dom_html_legend_element_set_access_key(
+ dom_html_legend_element *element, dom_string *access_key);
+
+dom_exception dom_html_legend_element_get_align(
+ dom_html_legend_element *element, dom_string **align);
+
+dom_exception dom_html_legend_element_set_align(
+ dom_html_legend_element *ele, dom_string *align);
+
+#endif
diff --git a/src/html/Makefile b/src/html/Makefile
index ed27c07..98aa094 100644
--- a/src/html/Makefile
+++ b/src/html/Makefile
@@ -7,11 +7,11 @@ DIR_SOURCES := \
html_body_element.c html_form_element.c html_select_element.c \
html_button_element.c html_input_element.c html_text_area_element.c \
html_opt_group_element.c html_option_element.c html_hr_element.c \
- html_dlist_element.c html_directory_element.c html_menu_element.c
+ html_dlist_element.c html_directory_element.c html_menu_element.c \
+ html_fieldset_element.c html_legend_element.c
UNINMPLEMENTED_SOURCES := \
- html_label_element.c html_fieldset_element.c \
- html_legend_element.c html_ulist_element.c html_olist_element.c \
+ html_label_element.c html_ulist_element.c html_olist_element.c \
html_li_element.c html_div_element.c html_paragraph_element.c \
html_heading_element.c html_quote_element.c html_pre_element.c \
html_br_element.c html_basefont_element.c html_font_element.c \
diff --git a/src/html/TODO b/src/html/TODO
index 5cdf641..b6ed604 100644
--- a/src/html/TODO
+++ b/src/html/TODO
@@ -19,8 +19,8 @@ HTMLInputElement html_input_element MISSING
HTMLTextAreaElement html_textarea_element MISSING
HTMLButtonElement html_button_element MISSING
HTMLLabelElement html_label_element MISSING
-HTMLFieldSetElement html_fieldset_element MISSING
-HTMLLegendElement html_legend_element MISSING
+HTMLFieldSetElement html_fieldset_element DONE
+HTMLLegendElement html_legend_element DONE
HTMLUListElement html_ulist_element MISSING
HTMLOListElement html_olist_element MISSING
HTMLDListElement html_dlist_element DONE
diff --git a/src/html/html_document.c b/src/html/html_document.c
index 7a10f2a..27016ef 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -28,6 +28,8 @@
#include "html/html_dlist_element.h"
#include "html/html_directory_element.h"
#include "html/html_menu_element.h"
+#include "html/html_fieldset_element.h"
+#include "html/html_legend_element.h"
#include "core/attr.h"
#include "core/string.h"
@@ -236,6 +238,12 @@ _dom_html_document_create_element_internal(dom_html_document *html,
} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_MENU])) {
exc = _dom_html_menu_element_create(html, namespace, prefix,
(dom_html_menu_element **) result);
+ } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FIELDSET])) {
+ exc = _dom_html_field_set_element_create(html, namespace, prefix,
+ (dom_html_field_set_element **) result);
+ } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LEGEND])) {
+ exc = _dom_html_legend_element_create(html, namespace, prefix,
+ (dom_html_legend_element **) result);
} else {
exc = _dom_html_element_create(html, tag_name, namespace,
prefix, result);
diff --git a/src/html/html_fieldset_element.c b/src/html/html_fieldset_element.c
index 2e182d5..2ab873e 100644
--- a/src/html/html_fieldset_element.c
+++ b/src/html/html_fieldset_element.c
@@ -3,5 +3,151 @@
* 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_fieldset_element.h>
+
+#include "html/html_document.h"
+#include "html/html_fieldset_element.h"
+
+#include "core/node.h"
+#include "utils/utils.h"
+
+static struct dom_element_protected_vtable _protect_vtable = {
+ {
+ DOM_NODE_PROTECT_VTABLE_HTML_FIELDSET_ELEMENT
+ },
+ DOM_HTML_FIELDSET_ELEMENT_PROTECT_VTABLE
+};
+
+/**
+ * Create a dom_html_field_set_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_field_set_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_field_set_element **ele)
+{
+ struct dom_node_internal *node;
+
+ *ele = malloc(sizeof(dom_html_field_set_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_field_set_element_initialise(doc, namespace, prefix, *ele);
+}
+
+/**
+ * Initialise a dom_html_field_set_element object
+ *
+ * \param doc The document object
+ * \param ele The dom_html_field_set_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_html_field_set_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_field_set_element *ele)
+{
+ return _dom_html_element_initialise(doc, &ele->base,
+ doc->memoised[hds_FIELDSET],
+ namespace, prefix);
+}
+
+/**
+ * Finalise a dom_html_field_set_element object
+ *
+ * \param ele The dom_html_field_set_element object
+ */
+void _dom_html_field_set_element_finalise(struct dom_html_field_set_element *ele)
+{
+ _dom_html_element_finalise(&ele->base);
+}
+
+/**
+ * Destroy a dom_html_field_set_element object
+ *
+ * \param ele The dom_html_field_set_element object
+ */
+void _dom_html_field_set_element_destroy(struct dom_html_field_set_element *ele)
+{
+ _dom_html_field_set_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_field_set_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_field_set_element_destroy(dom_node_internal *node)
+{
+ _dom_html_field_set_element_destroy((struct dom_html_field_set_element *) node);
+}
+
+/* The virtual copy function, see src/core/node.c for detail */
+dom_exception _dom_html_field_set_element_copy(dom_node_internal *old,
+ dom_node_internal **copy)
+{
+ return _dom_html_element_copy(old, copy);
+}
+
+/**
+ * Get the dom_html_form_element object
+ *
+ * \param field_set The dom_html_legend_element object
+ * \param form The returned dom_html_form_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+
+dom_exception dom_html_field_set_element_get_form(
+ dom_html_field_set_element *field_set, dom_html_form_element **form)
+{
+ dom_html_document *doc =
+ (dom_html_document *) ((dom_node_internal *) field_set)->owner;
+ dom_node_internal *form_tmp = ((dom_node_internal *) field_set)->parent;
+
+ /* Search ancestor chain for FIELDSET element */
+ while (form_tmp != NULL) {
+ if (form_tmp->type == DOM_ELEMENT_NODE &&
+ dom_string_caseless_isequal(form_tmp->name,
+ doc->memoised[hds_FORM]))
+ break;
+
+ form_tmp = form_tmp->parent;
+ }
+
+ if (form_tmp != NULL) {
+ *form = (dom_html_form_element *) form_tmp;
+ return DOM_NO_ERR;
+ }
+
+ *form = NULL;
+
+ return DOM_NO_ERR;
+}
diff --git a/src/html/html_fieldset_element.h b/src/html/html_fieldset_element.h
index 2e182d5..8ae1d59 100644
--- a/src/html/html_fieldset_element.h
+++ b/src/html/html_fieldset_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_field_set_element_h_
+#define dom_internal_html_field_set_element_h_
+
+#include <dom/html/html_fieldset_element.h>
+
+#include "html/html_element.h"
+
+struct dom_html_field_set_element {
+ struct dom_html_element base;
+ /**< The base class */
+};
+
+/* Create a dom_html_field_set_element object */
+dom_exception _dom_html_field_set_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_field_set_element **ele);
+
+/* Initialise a dom_html_field_set_element object */
+dom_exception _dom_html_field_set_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_field_set_element *ele);
+
+/* Finalise a dom_html_field_set_element object */
+void _dom_html_field_set_element_finalise(struct dom_html_field_set_element *ele);
+
+/* Destroy a dom_html_field_set_element object */
+void _dom_html_field_set_element_destroy(struct dom_html_field_set_element *ele);
+
+/* The protected virtual functions */
+dom_exception _dom_html_field_set_element_parse_attribute(dom_element *ele,
+ dom_string *name, dom_string *value,
+ dom_string **parsed);
+void _dom_virtual_html_field_set_element_destroy(dom_node_internal *node);
+dom_exception _dom_html_field_set_element_copy(dom_node_internal *old,
+ dom_node_internal **copy);
+
+#define DOM_HTML_FIELDSET_ELEMENT_PROTECT_VTABLE \
+ _dom_html_field_set_element_parse_attribute
+
+#define DOM_NODE_PROTECT_VTABLE_HTML_FIELDSET_ELEMENT \
+ _dom_virtual_html_field_set_element_destroy, \
+ _dom_html_field_set_element_copy
+
+#endif
+
diff --git a/src/html/html_form_element.c b/src/html/html_form_element.c
index 333cf74..0606ba6 100644
--- a/src/html/html_form_element.c
+++ b/src/html/html_form_element.c
@@ -281,7 +281,7 @@ static bool _dom_is_form_control(struct dom_node_internal *node, void *ctx)
assert(node->type == DOM_ELEMENT_NODE);
- /* Form controls are INPUT TEXTAREA SELECT and BUTTON */
+ /* Form controls are INPUT TEXTAREA SELECT and BUTTON*/
if (dom_string_caseless_isequal(node->name,
doc->memoised[hds_INPUT]))
return ((dom_html_input_element *)node)->form == form;
diff --git a/src/html/html_legend_element.c b/src/html/html_legend_element.c
index 2e182d5..2d0e939 100644
--- a/src/html/html_legend_element.c
+++ b/src/html/html_legend_element.c
@@ -3,5 +3,213 @@
* 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_legend_element.h>
+#include <dom/html/html_fieldset_element.h>
+
+#include "html/html_document.h"
+#include "html/html_legend_element.h"
+
+#include "core/node.h"
+#include "core/attr.h"
+#include "utils/utils.h"
+
+static struct dom_element_protected_vtable _protect_vtable = {
+ {
+ DOM_NODE_PROTECT_VTABLE_HTML_LEGEND_ELEMENT
+ },
+ DOM_HTML_LEGEND_ELEMENT_PROTECT_VTABLE
+};
+
+/**
+ * Create a dom_html_legend_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_legend_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_legend_element **ele)
+{
+ struct dom_node_internal *node;
+
+ *ele = malloc(sizeof(dom_html_legend_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_legend_element_initialise(doc, namespace, prefix, *ele);
+}
+
+/**
+ * Initialise a dom_html_legend_element object
+ *
+ * \param doc The document object
+ * \param ele The dom_html_legend_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_html_legend_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_legend_element *ele)
+{
+ return _dom_html_element_initialise(doc, &ele->base,
+ doc->memoised[hds_LEGEND],
+ namespace, prefix);
+}
+
+/**
+ * Finalise a dom_html_legend_element object
+ *
+ * \param ele The dom_html_legend_element object
+ */
+void _dom_html_legend_element_finalise(struct dom_html_legend_element *ele)
+{
+ _dom_html_element_finalise(&ele->base);
+}
+
+/**
+ * Destroy a dom_html_legend_element object
+ *
+ * \param ele The dom_html_legend_element object
+ */
+void _dom_html_legend_element_destroy(struct dom_html_legend_element *ele)
+{
+ _dom_html_legend_element_finalise(ele);
+ free(ele);
+}
+
+/**
+ * Get the dom_html_form_element object
+ *
+ * \param legend The dom_html_legend_element object
+ * \param form The returned dom_html_form_element object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception dom_html_legend_element_get_form(
+ dom_html_legend_element *legend, dom_html_form_element **form)
+{
+ dom_html_document *doc
+ = (dom_html_document *) ((dom_node_internal *) legend)->owner;
+ dom_node_internal *field_set = ((dom_node_internal *) legend)->parent;
+
+ /* Search ancestor chain for FIELDSET element */
+ while (field_set != NULL) {
+ if (field_set->type == DOM_ELEMENT_NODE &&
+ dom_string_caseless_isequal(field_set->name,
+ doc->memoised[hds_FIELDSET]))
+ break;
+
+ field_set = field_set->parent;
+ }
+
+ if (field_set != NULL) {
+ return dom_html_field_set_element_get_form((dom_html_field_set_element *) field_set,
+ form);
+ }
+
+ *form = NULL;
+
+ return DOM_NO_ERR;
+}
+
+/*------------------------------------------------------------------------*/
+/* The protected virtual functions */
+
+/* The virtual function used to parse attribute value, see src/core/element.c
+ * for detail */
+dom_exception _dom_html_legend_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_legend_element_destroy(dom_node_internal *node)
+{
+ _dom_html_legend_element_destroy((struct dom_html_legend_element *) node);
+}
+
+/* The virtual copy function, see src/core/node.c for detail */
+dom_exception _dom_html_legend_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_legend_element_get_##attr( \
+ dom_html_legend_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_legend_element_set_##attr( \
+ dom_html_legend_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(access_key);
+SIMPLE_SET(align);
+
+dom_exception dom_html_legend_element_get_align(
+ dom_html_legend_element *legend, dom_string **align)
+{
+ dom_exception err;
+ dom_html_document *doc = (dom_html_document *)
+ ((dom_node_internal *)legend)->owner;
+ err = dom_element_get_attribute(legend,
+ doc->memoised[hds_align], align);
+ if (err != DOM_NO_ERR)
+ return err;
+
+ if (*align == NULL) {
+ err = dom_string_create((const uint8_t *) "none", SLEN("none"), align);
+ }
+
+ return err;
+}
+
diff --git a/src/html/html_legend_element.h b/src/html/html_legend_element.h
index 2e182d5..a656ae4 100644
--- a/src/html/html_legend_element.h
+++ b/src/html/html_legend_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_legend_element_h_
+#define dom_internal_html_legend_element_h_
+
+#include <dom/html/html_legend_element.h>
+#include "html/html_element.h"
+
+
+struct dom_html_legend_element {
+ struct dom_html_element base;
+ /**< The base class */
+};
+
+/* Create a dom_html_legend_element object */
+dom_exception _dom_html_legend_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_legend_element **ele);
+
+/* Initialise a dom_html_legend_element object */
+dom_exception _dom_html_legend_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
+ struct dom_html_legend_element *ele);
+
+/* Finalise a dom_html_legend_element object */
+void _dom_html_legend_element_finalise(struct dom_html_legend_element *ele);
+
+/* Destroy a dom_html_legend_element object */
+void _dom_html_legend_element_destroy(struct dom_html_legend_element *ele);
+
+/* The protected virtual functions */
+dom_exception _dom_html_legend_element_parse_attribute(dom_element *ele,
+ dom_string *name, dom_string *value,
+ dom_string **parsed);
+void _dom_virtual_html_legend_element_destroy(dom_node_internal *node);
+dom_exception _dom_html_legend_element_copy(dom_node_internal *old,
+ dom_node_internal **copy);
+
+#define DOM_HTML_LEGEND_ELEMENT_PROTECT_VTABLE \
+ _dom_html_legend_element_parse_attribute
+
+#define DOM_NODE_PROTECT_VTABLE_HTML_LEGEND_ELEMENT \
+ _dom_virtual_html_legend_element_destroy, \
+ _dom_html_legend_element_copy
+
+#endif
+
diff --git a/test/testcases/tests/level1/html/HTMLFieldSetElement01.xml.kfail b/test/testcases/tests/level1/html/HTMLFieldSetElement01.xml
index b6c6e98..b6c6e98 100644
--- a/test/testcases/tests/level1/html/HTMLFieldSetElement01.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLFieldSetElement01.xml
diff --git a/test/testcases/tests/level1/html/HTMLFieldSetElement02.xml.kfail b/test/testcases/tests/level1/html/HTMLFieldSetElement02.xml
index 09d0877..09d0877 100644
--- a/test/testcases/tests/level1/html/HTMLFieldSetElement02.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLFieldSetElement02.xml
diff --git a/test/testcases/tests/level1/html/HTMLLegendElement01.xml.kfail b/test/testcases/tests/level1/html/HTMLLegendElement01.xml
index f478379..f478379 100644
--- a/test/testcases/tests/level1/html/HTMLLegendElement01.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLLegendElement01.xml
diff --git a/test/testcases/tests/level1/html/HTMLLegendElement02.xml.kfail b/test/testcases/tests/level1/html/HTMLLegendElement02.xml
index 19cf87f..19cf87f 100644
--- a/test/testcases/tests/level1/html/HTMLLegendElement02.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLLegendElement02.xml
diff --git a/test/testcases/tests/level1/html/HTMLLegendElement03.xml.kfail b/test/testcases/tests/level1/html/HTMLLegendElement03.xml
index a3747fd..a3747fd 100644
--- a/test/testcases/tests/level1/html/HTMLLegendElement03.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLLegendElement03.xml
diff --git a/test/testcases/tests/level1/html/HTMLLegendElement04.xml.kfail b/test/testcases/tests/level1/html/HTMLLegendElement04.xml
index fa3e76c..fa3e76c 100644
--- a/test/testcases/tests/level1/html/HTMLLegendElement04.xml.kfail
+++ b/test/testcases/tests/level1/html/HTMLLegendElement04.xml