summaryrefslogtreecommitdiff
path: root/src/html
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2014-01-05 15:36:43 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2014-01-05 15:36:43 +0000
commit424c12d02a0065c2889477b12572262ec1ca1ca7 (patch)
tree0d665ebcb7786074e421c72b2862d70003054907 /src/html
parent578704d5a4df0fc7001efe64a5abb343fd2f2b70 (diff)
downloadlibdom-424c12d02a0065c2889477b12572262ec1ca1ca7.tar.gz
libdom-424c12d02a0065c2889477b12572262ec1ca1ca7.tar.bz2
Fix the form iterator test
Diffstat (limited to 'src/html')
-rw-r--r--src/html/html_form_element.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/html/html_form_element.c b/src/html/html_form_element.c
index fac717b..333cf74 100644
--- a/src/html/html_form_element.c
+++ b/src/html/html_form_element.c
@@ -11,6 +11,9 @@
#include <dom/html/html_form_element.h>
#include "html/html_form_element.h"
+#include "html/html_input_element.h"
+#include "html/html_select_element.h"
+#include "html/html_text_area_element.h"
#include "html/html_button_element.h"
#include "html/html_collection.h"
@@ -273,36 +276,24 @@ static bool _dom_is_form_control(struct dom_node_internal *node, void *ctx)
{
struct dom_html_document *doc =
(struct dom_html_document *)(node->owner);
- struct dom_html_form_element *form = ctx, *form2;
+ struct dom_html_form_element *form = ctx;
assert(node->type == DOM_ELEMENT_NODE);
- /* This should check the form of each element *AND* node that
- * buttons leak the forms too! ARGH
- */
-
/* Form controls are INPUT TEXTAREA SELECT and BUTTON */
if (dom_string_caseless_isequal(node->name,
doc->memoised[hds_INPUT]))
- return true;
+ return ((dom_html_input_element *)node)->form == form;
if (dom_string_caseless_isequal(node->name,
doc->memoised[hds_TEXTAREA]))
- return true;
+ return ((dom_html_text_area_element *)node)->form == form;
if (dom_string_caseless_isequal(node->name,
doc->memoised[hds_SELECT]))
- return true;
+ return ((dom_html_select_element *)node)->form == form;
if (dom_string_caseless_isequal(node->name,
doc->memoised[hds_BUTTON])) {
- dom_html_button_element *button =
- (dom_html_button_element *) node;
- dom_exception err =
- dom_html_button_element_get_form(button, &form2);
- if (err == DOM_NO_ERR) {
- return form == form2;
- }
- /* Couldn't get the form, assume it's not ours. */
- return false;
+ return ((dom_html_button_element *)node)->form == form;
}
return false;