richMode/getChildren: validate element types.
test: more robust assertions

The previous assertions, which relied on innerHTML, were too strict.
We may want to add/remove classes in the future, but, for example,
we don’t want to have to update all the paragraph tests (of which
there are many) because we want to add classes to the containing
sections; additionally, with multiple classes, different browsers
may not order them the same way. The new system, while being a little
more verbose, offers more flexibility in what we compare.
richMode: implement paragraph-(first|last) classes

The bits relating to section adding/removal still needs testing, though.