On retail, when a target goes out of range while a spell is casting (for non-instant spells), the spell still casts as long as the target hasn't moved too far away (5 yards) when the spell is actually cast. This has always been the correct behaviour.