Resolves TypeError when adding spans.

This resolves a TypeError that popped up when I ran asHtml() on a document containing an empty fragment.

*TypeError: Cannot read property 'span' of undefined*