use the dom-serializer module

less duplicated code
added `opts` argument to `getInnerHTML`