use closestChild instead of children when replacing child template div