diff options
-rw-r--r-- | include/dom/dom.h | 1 | ||||
-rw-r--r-- | include/dom/html/html_base_element.h | 16 | ||||
-rw-r--r-- | src/html/TODO | 6 | ||||
-rw-r--r-- | src/html/html_base_element.c | 43 | ||||
-rw-r--r-- | test/testcases/tests/level1/html/HTMLBaseElement01.xml.notimpl | 42 | ||||
-rw-r--r-- | test/testcases/tests/level1/html/HTMLBaseElement02.xml.notimpl | 42 |
6 files changed, 63 insertions, 87 deletions
diff --git a/include/dom/dom.h b/include/dom/dom.h index fb39388..2c312f4 100644 --- a/include/dom/dom.h +++ b/include/dom/dom.h @@ -88,6 +88,7 @@ #include <dom/html/html_tablesection_element.h> #include <dom/html/html_table_element.h> #include <dom/html/html_tablerow_element.h> +#include <dom/html/html_base_element.h> /* DOM Events header */ #include <dom/events/events.h> diff --git a/include/dom/html/html_base_element.h b/include/dom/html/html_base_element.h index 5ff28ee..c8283f3 100644 --- a/include/dom/html/html_base_element.h +++ b/include/dom/html/html_base_element.h @@ -8,7 +8,23 @@ #ifndef dom_html_base_element_h_ #define dom_html_base_element_h_ +#include <stdbool.h> +#include <dom/core/exceptions.h> +#include <dom/core/string.h> + typedef struct dom_html_base_element dom_html_base_element; +dom_exception dom_html_base_element_get_href( + dom_html_base_element *element, dom_string **href); + +dom_exception dom_html_base_element_set_href( + dom_html_base_element *element, dom_string *href); + +dom_exception dom_html_base_element_get_target( + dom_html_base_element *element, dom_string **target); + +dom_exception dom_html_base_element_set_target( + dom_html_base_element *element, dom_string *target); + #endif diff --git a/src/html/TODO b/src/html/TODO index 0a75535..97eab8e 100644 --- a/src/html/TODO +++ b/src/html/TODO @@ -4,10 +4,10 @@ as far as the test suite is concerned. HTMLElement html_element DONE HTMLHtmlElement html_html_element DONE HTMLHeadElement html_head_element DONE -HTMLLinkElement html_link_element MISSING +HTMLLinkElement html_link_element DONE HTMLTitleElement html_title_element DONE -HTMLMetaElement html_meta_element MISSING -HTMLBaseElement html_base_element MISSING +HTMLMetaElement html_meta_element DONE +HTMLBaseElement html_base_element DONE HTMLIsIndexElement html_isindex_element MISSING HTMLStyleElement html_style_element MISSING HTMLBodyElement html_body_element MISSING diff --git a/src/html/html_base_element.c b/src/html/html_base_element.c index 150ef37..6be8e3a 100644 --- a/src/html/html_base_element.c +++ b/src/html/html_base_element.c @@ -7,6 +7,7 @@ #include <stdlib.h> +#include "html/html_document.h" #include "html/html_base_element.h" #include "core/node.h" @@ -118,3 +119,45 @@ dom_exception _dom_html_base_element_copy(dom_node_internal *old, return _dom_html_element_copy(old, copy); } +/*-----------------------------------------------------------------------*/ +/* API functions */ + +#define SIMPLE_GET(attr) \ + dom_exception dom_html_base_element_get_##attr( \ + dom_html_base_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_base_element_set_##attr( \ + dom_html_base_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(href); +SIMPLE_GET_SET(target); diff --git a/test/testcases/tests/level1/html/HTMLBaseElement01.xml.notimpl b/test/testcases/tests/level1/html/HTMLBaseElement01.xml.notimpl deleted file mode 100644 index fa6eacc..0000000 --- a/test/testcases/tests/level1/html/HTMLBaseElement01.xml.notimpl +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> - -<!-- - -Copyright (c) 2001-2004 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 "dom1.dtd"> -<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLBaseElement01"> -<metadata> -<title>HTMLBaseElement01</title> -<creator>NIST</creator> -<description> - The href attribute specifies the base URI. - - Retrieve the href attribute and examine its value. -</description> -<contributor>Mary Brady</contributor> -<date qualifier="created">2002-02-22</date> -<subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65382887"/> -</metadata> -<var name="nodeList" type="NodeList"/> -<var name="testNode" type="Node"/> -<var name="vhref" type="DOMString" /> -<var name="doc" type="Document"/> -<load var="doc" href="base" willBeModified="false"/> -<getElementsByTagName interface="Document" obj="doc" var="nodeList" tagname='"base"'/> -<assertSize collection="nodeList" size="1" id="Asize"/> -<item interface="NodeList" obj="nodeList" var="testNode" index="0"/> -<href interface="HTMLBaseElement" obj="testNode" var="vhref"/> -<assertEquals actual="vhref" expected='"about:blank"' id="hrefLink" ignoreCase="false"/> -</test> diff --git a/test/testcases/tests/level1/html/HTMLBaseElement02.xml.notimpl b/test/testcases/tests/level1/html/HTMLBaseElement02.xml.notimpl deleted file mode 100644 index d2a20a5..0000000 --- a/test/testcases/tests/level1/html/HTMLBaseElement02.xml.notimpl +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
-
-<!--
-
-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 "dom1.dtd">
-<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLBaseElement02">
-<metadata>
-<title>HTMLBaseElement02</title>
-<creator>NIST</creator>
-<description>
- The target attribute specifies the default target frame. -
- Retrieve the target attribute and examine its value.
-</description>
-<contributor>Rick Rivello</contributor>
-<date qualifier="created">2002-07-18</date>
-<subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73844298"/>
-</metadata>
-<var name="nodeList" type="NodeList"/>
-<var name="testNode" type="Node"/>
-<var name="vtarget" type="DOMString" />
-<var name="doc" type="Document"/>
-<load var="doc" href="base2" willBeModified="false"/>
-<getElementsByTagName interface="Document" obj="doc" var="nodeList" tagname='"base"'/>
-<assertSize collection="nodeList" size="1" id="Asize"/>
-<item interface="NodeList" obj="nodeList" var="testNode" index="0"/>
-<target interface="HTMLBaseElement" obj="testNode" var="vtarget"/>
-<assertEquals actual="vtarget" expected='"Frame1"' id="targetLink" ignoreCase="false"/>
-</test>
|