summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrsk1994 <rsk1coder99@gmail.com>2014-06-03 10:32:33 +0530
committerRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-06-11 04:27:12 +0530
commitac0a6be4a62b2fa9830184def0652a499df1398b (patch)
tree5e324f654a79e7a512a00688136db256941310f6 /src
parent5c0d74591877de6bcced0a6ba5836b4a2df1c5a7 (diff)
downloadlibdom-ac0a6be4a62b2fa9830184def0652a499df1398b.tar.gz
libdom-ac0a6be4a62b2fa9830184def0652a499df1398b.tar.bz2
OptionElement
Diffstat (limited to 'src')
-rw-r--r--src/html/TODO4
-rw-r--r--src/html/html_option_element.c19
2 files changed, 16 insertions, 7 deletions
diff --git a/src/html/TODO b/src/html/TODO
index 8e004e1..6a3d190 100644
--- a/src/html/TODO
+++ b/src/html/TODO
@@ -13,8 +13,8 @@ HTMLStyleElement html_style_element DONE
HTMLBodyElement html_body_element MISSING
HTMLFormElement html_form_element DONE
HTMLSelectElement html_select_element DONE
-HTMLOptGroupElement html_optgroup_element MISSING
-HTMLOptionElement html_option_element MISSING
+HTMLOptGroupElement html_optgroup_element DONE
+HTMLOptionElement html_option_element DONE
HTMLInputElement html_input_element MISSING
HTMLTextAreaElement html_textarea_element MISSING
HTMLButtonElement html_button_element MISSING
diff --git a/src/html/html_option_element.c b/src/html/html_option_element.c
index b133deb..b777c5f 100644
--- a/src/html/html_option_element.c
+++ b/src/html/html_option_element.c
@@ -255,13 +255,22 @@ dom_exception dom_html_option_element_get_text(
* \return DOM_NO_ERR on success, appropriate error otherwise.
*/
dom_exception dom_html_option_element_get_index(
- dom_html_option_element *option, unsigned long *index)
+ dom_html_option_element *option, int32_t *index)
{
- UNUSED(option);
- UNUSED(index);
+ dom_html_document *doc = (dom_html_document *) dom_node_get_owner(option);
+ int32_t idx = 0;
+ dom_node_internal *n = ((dom_node_internal *)option)->parent;
- /** \todo Implement */
- return DOM_NOT_SUPPORTED_ERR;
+ for(n = n->first_child;n != NULL; n = n->next) {
+ if((dom_node_internal *)option == n) {
+ *index = idx;
+ break;
+ } else if(dom_string_caseless_isequal(n->name,doc->memoised[hds_OPTION])) {
+ idx += 1;
+ }
+ }
+
+ return DOM_NO_ERR;
}
/**