From f0a3c95cfc4a5595f930cd5dd14d6cbbf1f85312 Mon Sep 17 00:00:00 2001 From: rsk1994 Date: Sat, 31 May 2014 09:07:42 +0530 Subject: tableSectionElement Rev.2 && tableCellElement Rev.4 && tableElement Rev.1 && tableRowElement Rev.1 && DOMTSHandler(Test Suite) Revised and implemented inefficient ways to produce correct .c's && other minor bg fixes in HTMLCollection... Tests expecting 2nd attribute of dom_html_collection_get_length to be of type int32_t aren't enabled yet. Will be done in a later commit. --- src/html/html_tablecell_element.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/html/html_tablecell_element.c') diff --git a/src/html/html_tablecell_element.c b/src/html/html_tablecell_element.c index f8eaf01..cc596c1 100644 --- a/src/html/html_tablecell_element.c +++ b/src/html/html_tablecell_element.c @@ -191,6 +191,7 @@ dom_exception dom_html_table_cell_element_get_cell_index( } n = n->parent; } + dom_node_internal *root = n; while(n != NULL) { if(n == (dom_node_internal *)table_cell) { break; @@ -207,18 +208,16 @@ dom_exception dom_html_table_cell_element_get_cell_index( } else { /* No children and siblings */ struct dom_node_internal *parent = n->parent; - - while (parent !=NULL) { - if(n == parent->last_child) { - n = parent; - parent = parent->parent; - } else { - break; - } - + while (n == parent->last_child && + n != root) { + n = parent; + parent = parent->parent; } - if(parent == NULL) { + + if(n == root) { n = NULL; + } else { + n = n->next; } } } -- cgit v1.2.3