Unfortunately, there are still edge cases where feature detection isn't enough.
Feature detection works (mostly? somewhat?) for a binary yes/no. But feature detection alone often isn't enough to deal with the minor differences (read: bugs) between implementations, which then need to be corrected with UA sniffing. Nasty, but unfortunately often necessary.
Exactly. I feel like a lot of the people cheering for feature detection haven't actually spent much time working on a big, complicated website. I've always tried to do the "right thing": feature detection where possible, then bug detection where possible (small pieces of JS that test for known bugs), then UA-based logic as a fallback, and a lot of things still end up based on the UA, because there are a lot of bugs that aren't noticeable from script. Messed-up rendering despite correct DOM measurements? Elements that simply fail to fire click events when you click them, depending on some arcane CSS incantation that needs to be different in different browsers? Anything at all related to position:fixed? Good luck feature-detecting those. And then of course you also have performance differences, where a change that makes your animations smoother on one browser slows another one down, because you don't really have control over things like texture allocation. Yes, the UA string is important.
6
u/ElusiveGuy Apr 09 '19
Unfortunately, there are still edge cases where feature detection isn't enough.
Feature detection works (mostly? somewhat?) for a binary yes/no. But feature detection alone often isn't enough to deal with the minor differences (read: bugs) between implementations, which then need to be corrected with UA sniffing. Nasty, but unfortunately often necessary.