renderElements uses createDocumentFragment to improve speed