summaryrefslogtreecommitdiff
path: root/lib/dojo/uacss.js.uncompressed.js
diff options
context:
space:
mode:
authorRichard Beales <[email protected]>2013-03-18 07:32:01 +0000
committerRichard Beales <[email protected]>2013-03-18 07:32:01 +0000
commit7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch)
tree5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dojo/uacss.js.uncompressed.js
parent70db7424e7068701e60cc5bcdfe8f858be508179 (diff)
parentc670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dojo/uacss.js.uncompressed.js')
-rw-r--r--lib/dojo/uacss.js.uncompressed.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/dojo/uacss.js.uncompressed.js b/lib/dojo/uacss.js.uncompressed.js
new file mode 100644
index 000000000..f3207b0f5
--- /dev/null
+++ b/lib/dojo/uacss.js.uncompressed.js
@@ -0,0 +1,77 @@
+define("dojo/uacss", ["./dom-geometry", "./_base/lang", "./ready", "./sniff", "./_base/window"],
+ function(geometry, lang, ready, has, baseWindow){
+
+ // module:
+ // dojo/uacss
+
+ /*=====
+ return {
+ // 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.
+ //
+ // Returns the has() method.
+ };
+ =====*/
+
+ var
+ html = baseWindow.doc.documentElement,
+ ie = has("ie"),
+ opera = has("opera"),
+ maj = Math.floor,
+ ff = has("ff"),
+ boxModel = geometry.boxModel.replace(/-/,''),
+
+ classes = {
+ "dj_quirks": has("quirks"),
+
+ // NOTE: Opera not supported by dijit
+ "dj_opera": opera,
+
+ "dj_khtml": has("khtml"),
+
+ "dj_webkit": has("webkit"),
+ "dj_safari": has("safari"),
+ "dj_chrome": has("chrome"),
+
+ "dj_gecko": has("mozilla")
+ }; // no dojo unsupported browsers
+
+ if(ie){
+ classes["dj_ie"] = true;
+ classes["dj_ie" + maj(ie)] = true;
+ classes["dj_iequirks"] = has("quirks");
+ }
+ if(ff){
+ classes["dj_ff" + maj(ff)] = true;
+ }
+
+ classes["dj_" + boxModel] = true;
+
+ // apply browser, browser version, and box model class names
+ var classStr = "";
+ for(var clz in classes){
+ if(classes[clz]){
+ classStr += clz + " ";
+ }
+ }
+ html.className = lang.trim(html.className + " " + classStr);
+
+ // If RTL mode, then add dj_rtl flag plus repeat existing classes with -rtl extension.
+ // We can't run the code below until the <body> tag has loaded (so we can check for dir=rtl).
+ // priority is 90 to run ahead of parser priority of 100
+ ready(90, function(){
+ if(!geometry.isBodyLtr()){
+ var rtlClassStr = "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl ");
+ html.className = lang.trim(html.className + " " + rtlClassStr + "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl "));
+ }
+ });
+ return has;
+});