} else if ("tfoot".equals(sectionTag)) {
tmpElem.setInnerSafeHtml(template.tfoot(rowHtml));
} else {
throw new IllegalArgumentException("Invalid table section tag: " + sectionTag);
}
TableElement tableElem = tmpElem.getFirstChildElement().cast();
// Detach the event listener.
DOM.setEventListener(tmpElem, null);
// Get the section out of the table.
if ("tbody".equals(sectionTag)) {
return tableElem.getTBodies().getItem(0);
} else if ("thead".equals(sectionTag)) {
return tableElem.getTHead();
} else if ("tfoot".equals(sectionTag)) {
return tableElem.getTFoot();
} else {
throw new IllegalArgumentException("Invalid table section tag: " + sectionTag);
}
}