setImmediate for inserting the document fragment