Implement rowIndex property on <tr>.

Part of https://github.com/servo/servo/issues/10509.
This commit is contained in:
Corey Farwell 2016-04-10 12:04:57 -04:00
parent ea97c89055
commit 23eb15c820
5 changed files with 31 additions and 45 deletions

View file

@ -118,6 +118,13 @@ impl HTMLTableElement {
thead.upcast::<Node>().remove_self();
}
}
/// Determine the row index for the given `HTMLTableRowElement`.
pub fn row_index(&self, row_elem: &HTMLTableRowElement) -> Option<usize> {
self.Rows()
.elements_iter()
.position(|elem| (&elem as &Element) == row_elem.upcast::<Element>())
}
}
impl HTMLTableElementMethods for HTMLTableElement {