]> git.wh0rd.org Git - tt-rss.git/blob - lib/dojo/uacss.js
upgrade Dojo to 1.6.1
[tt-rss.git] / lib / dojo / uacss.js
1 /*
2         Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
3         Available via Academic Free License >= 2.1 OR the modified BSD license.
4         see: http://dojotoolkit.org/license for details
5 */
6
7
8 if(!dojo._hasResource["dojo.uacss"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
9 dojo._hasResource["dojo.uacss"] = true;
10 dojo.provide("dojo.uacss");
11
12
13 (function(){
14         // summary:
15         //              Applies pre-set CSS classes to the top-level HTML node, based on:
16         //                      - browser (ex: dj_ie)
17         //                      - browser version (ex: dj_ie6)
18         //                      - box model (ex: dj_contentBox)
19         //                      - text direction (ex: dijitRtl)
20         //
21         //              In addition, browser, browser version, and box model are
22         //              combined with an RTL flag when browser text is RTL.  ex: dj_ie-rtl.
23
24         var d = dojo,
25                 html = d.doc.documentElement,
26                 ie = d.isIE,
27                 opera = d.isOpera,
28                 maj = Math.floor,
29                 ff = d.isFF,
30                 boxModel = d.boxModel.replace(/-/,''),
31
32                 classes = {
33                         dj_ie: ie,
34                         dj_ie6: maj(ie) == 6,
35                         dj_ie7: maj(ie) == 7,
36                         dj_ie8: maj(ie) == 8,
37                         dj_ie9: maj(ie) == 9,
38                         dj_quirks: d.isQuirks,
39                         dj_iequirks: ie && d.isQuirks,
40
41                         // NOTE: Opera not supported by dijit
42                         dj_opera: opera,
43
44                         dj_khtml: d.isKhtml,
45
46                         dj_webkit: d.isWebKit,
47                         dj_safari: d.isSafari,
48                         dj_chrome: d.isChrome,
49
50                         dj_gecko: d.isMozilla,
51                         dj_ff3: maj(ff) == 3
52                 }; // no dojo unsupported browsers
53
54         classes["dj_" + boxModel] = true;
55
56         // apply browser, browser version, and box model class names
57         var classStr = "";
58         for(var clz in classes){
59                 if(classes[clz]){
60                         classStr += clz + " ";
61                 }
62         }
63         html.className = d.trim(html.className + " " + classStr);
64
65         // If RTL mode, then add dj_rtl flag plus repeat existing classes with -rtl extension.
66         // We can't run the code below until the <body> tag has loaded (so we can check for dir=rtl).
67         // Unshift() is to run sniff code before the parser.
68         dojo._loaders.unshift(function(){
69                 if(!dojo._isBodyLtr()){
70                         var rtlClassStr = "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl ")
71                         html.className = d.trim(html.className + " " + rtlClassStr);
72                 }
73         });
74 })();
75
76 }