When div is of type string, replace it with a document element.