Well wouldn't it be cool if there was a JavaScript library that detects HTML5 and CSS3 features in the user’s browser so that you could know if a certain feature is supported instead of relying on browser detection (version nightmares ahead)...
There is... modernizr
From the Docs:
Why use Modernizr?
Taking advantage of cool new web technologies is great fun, until you have to support browsers that lag behind. Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether a browser supports a feature or not. It’s perfect for doing progressive enhancement easily.
How it works
Modernizr runs quickly on page load to detect features; it then creates a JavaScript object with the results, and adds classes to the html element for you to key your CSS on. Modernizr supports dozens of tests, and optionally includes YepNope.js for conditional loading of external .js and .css resources.
An Example (also from the docs)
Modernizr.load({
test: Modernizr.geolocation,
yep : 'geo.js',
nope: 'geo-polyfill.js'
});
In this example, we decided that we should load a different script depending on whether geolocation is supported in the host browser or not. By doing this, you save users from having to download code that their browser does not need. This increases page performance, and offers a clear place to build a healthy amount of abstraction to your polyfills (both 'geo.js' and 'geo-polyfill.js' would seem the same to the rest of the app, even if they're implemented differently).
IMO modernizr
is the de facto feature detection JavaScript Library and I use it on ALL my projects. It does have a slight learning curve, but the docs are great, and cover pretty much every feature, and the flexibility it provides you within the above example alone is enough of a reason to use it.