Java Reference
In-Depth Information
This code creates an arbitrary <span/> element and checks if it has a draggable property or
ondragstart and ondrop properties. If any of these conditions are true, the browser supports drag
and drop.
Note The aforementioned test is written to accommodate IE8 because it
supports native drag and drop, but it doesn't support the draggable attribute/
property.
This code, however, is cumbersome to write and read. Modernizr simplifies it to:
if (Modernizr.draganddrop) {
// use drag and drop
}
Here, you check the browser's support for drag and drop with Modernizr's draganddrop property,
and you get the same results as the previous test.
Modernizr checks for a wide variety of HTML5 (and CSS3) features. The following table lists just a few:
html5 feature
modernizr propertY
HTML5 Audio
audio
M4A Audio
audio.m4a
MP3 Audio
audio.mp3
OGG Audio
audio.ogg
WAV Audio
audio.wav
HTML5 Video
video
H.264 Video
video.h264
OGG Video
video.ogg
WebM Video
video.webm
Drag and Drop
draganddrop
Local Storage
localstorage
Geolocation
geolocation
In addition to the builtā€in tests, you can also extend Modernizr with your own tests.
Custom tests
You can add your own tests to Modernizr with its addTest() method. The process is simple: simply
call Modernizr.addTest() , pass it the name of your test, and pass the function that performs the test.
 
Search WWH ::




Custom Search