Closed henbos closed 8 months ago
The risk is that people feature detect with if (track.stats)
and it works on Browser A which in version 1 had not implemented the API (thus returning undefined), and in version 2 had implemented it for a particular type of track, then that track type never threw in Browser A's versioning history. Then Browser B comes along and implements track stats for some track types, but not others, and so now throwing becomes a possibility. But because people never needed to try-catch to feature detect, we now have backwards/cross-browser compat issues where the app works in Browser A but not in Browser B.
It seems like a real possibility too that we expand which track types should be supported in the future, so app developers not having to worry about exceptions in some version and not others seems preferable, unless there is some benefit to exceptions, but I don't think there is in this case
if (track.stats) { ... }
is a much better feature detection thanThere really doesn't seem to be any benefit to throwing versus making the attribute nullable as far as I can tell.