IE document fragment work arounds

DocumentFragments are broken in Internet Explorer. There are cases where they are not valid trees.

These work-arounds try to minimize the damage done in these cases.