- Author:
- David Nickerson <nickerso@users.sourceforge.net>
- Date:
- 2009-07-16 02:00:03+12:00
- Desc:
- the starting point for the HH tutorial example
- Permanent Source URI:
- https://models.fieldml.org/workspace/a1/rawfile/f6a8f90307388eb4b040ee3566b84d88b59247f7/dojo-presentation/js/dojo/dijit/_base/sniff.js
// summary:
// Applies pre-set CSS classes to the top-level HTML node, based on:
// - browser (ex: dj_ie)
// - browser version (ex: dj_ie6)
// - box model (ex: dj_contentBox)
// - text direction (ex: dijitRtl)
//
// In addition, browser, browser version, and box model are
// combined with an RTL flag when browser text is RTL. ex: dj_ie-rtl.
//
// Simply doing a require on this module will
// establish this CSS. Modified version of Morris' CSS hack.
dojo.provide("dijit._base.sniff");
(function(){
var d = dojo;
var ie = d.isIE;
var opera = d.isOpera;
var maj = Math.floor;
var ff = d.isFF;
var boxModel = d.boxModel.replace(/-/,'');
var classes = {
dj_ie: ie,
// dj_ie55: ie == 5.5,
dj_ie6: maj(ie) == 6,
dj_ie7: maj(ie) == 7,
dj_iequirks: ie && d.isQuirks,
// NOTE: Opera not supported by dijit
dj_opera: opera,
dj_opera8: maj(opera) == 8,
dj_opera9: maj(opera) == 9,
dj_khtml: d.isKhtml,
dj_safari: d.isSafari,
dj_gecko: d.isMozilla,
dj_ff2: maj(ff) == 2,
dj_ff3: maj(ff) == 3
}; // no dojo unsupported browsers
classes["dj_" + boxModel] = true;
var html = dojo.doc.documentElement;
// apply browser, browser version, and box model class names
for(var p in classes){
if(classes[p]){
if(html.className){
html.className += " " + p;
}else{
html.className = p;
}
}
}
// If RTL mode then add dijitRtl flag plus repeat existing classes
// with -rtl extension
// (unshift is to make this code run after <body> node is loaded but before parser runs)
dojo._loaders.unshift(function(){
if(!dojo._isBodyLtr()){
html.className += " dijitRtl";
for(var p in classes){
if(classes[p]){
html.className += " " + p+"-rtl";
}
}
}
});
})();