DOM4 methods, fix element traversal for document

New methods: append, prepend, before, after, replace, remove, query,
queryAll, matches