summaryrefslogtreecommitdiff
path: root/src/html
diff options
context:
space:
mode:
authorrsk1994 <rsk1coder99@gmail.com>2014-06-03 10:32:33 +0530
committerRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-06-21 17:37:14 +0530
commitfcfdb66ecfb1121f56a849ef087930cac017a5ed (patch)
tree3f7673cea91c19195c8932c38f2936149edda271 /src/html
parent8bc4bb6abf7f33cb100adacace73997fdb4dc1aa (diff)
downloadlibdom-fcfdb66ecfb1121f56a849ef087930cac017a5ed.tar.gz
libdom-fcfdb66ecfb1121f56a849ef087930cac017a5ed.tar.bz2
OptionElement
Diffstat (limited to 'src/html')
-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;
}
/**