Correctly process whitespace in DOM text mapper. Fixes #666