Corrected a defect when both scriptRepository and dom factory used