create document fragment if several top-level elements, otherwise return top-level element directly