sniff.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. if (!dojo._hasResource["dijit._base.sniff"]) { // _hasResource checks added by
  2. // build. Do not use
  3. // _hasResource directly in your
  4. // code.
  5. dojo._hasResource["dijit._base.sniff"] = true;
  6. dojo.provide("dijit._base.sniff");
  7. // ported from dojo.html.applyBrowserClass (style.js)
  8. // summary:
  9. // Applies pre-set class names based on browser & version to the
  10. // top-level HTML node. Simply doing a require on this module will
  11. // establish this CSS. Modified version of Morris' CSS hack.
  12. (function() {
  13. var d = dojo;
  14. var ie = d.isIE;
  15. var opera = d.isOpera;
  16. var maj = Math.floor;
  17. var classes = {
  18. dj_ie : ie,
  19. // dj_ie55: ie == 5.5,
  20. dj_ie6 : maj(ie) == 6,
  21. dj_ie7 : maj(ie) == 7,
  22. dj_iequirks : ie && d.isQuirks,
  23. // NOTE: Opera not supported by dijit
  24. dj_opera : opera,
  25. dj_opera8 : maj(opera) == 8,
  26. dj_opera9 : maj(opera) == 9,
  27. dj_khtml : d.isKhtml,
  28. dj_safari : d.isSafari,
  29. dj_gecko : d.isMozilla
  30. }; // no dojo unsupported browsers
  31. for (var p in classes) {
  32. if (classes[p]) {
  33. var html = dojo.doc.documentElement; // TODO browser-specific
  34. // DOM magic needed?
  35. if (html.className) {
  36. html.className += " " + p;
  37. } else {
  38. html.className = p;
  39. }
  40. }
  41. }
  42. })();
  43. }