Refs #406. Made table insertion check for the selection of any selectable table element to avoid nesting tables rather than only checking for the selection of a td element.
Refs #406. Added more tests to test for insertion into a th element or a caption element.