added code coverage that can handle bad html documents.