HTML and CSS Reference
In-Depth Information
__________
2
I should point out that “well-formed” does not mean the same as “valid.” For instance, a tag with
an attribute mymadeupattribute=“true” is well-formed but still invalid.
Since not all features of HTML5 are supported on current web browsers, it is a good
idea to detect for support of any features that do not fail gracefully. Modernizr (
ht-
tp://modernizr.com
)
is a JavaScript library that is worth investigating for this
purpose. The library detects the availability of HTML5 (and CSS3) features, whose
presence or absence are stored as Boolean values in a JavaScript object the Modernizr
functionality if the features are present or, otherwise, handle the page if they are not. For
example, to detect whether the
audio
element is supported, you could write the fol-
lowing in your page's JavaScript code:
// Check Modernizr object for audio Boolean value of true
if (Modernizr.audio) {
// Enable functionality on page for audio controls
}
else
{
Search WWH ::
Custom Search