diff options
author | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
---|---|---|
committer | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
commit | 7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch) | |
tree | 5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dojo/hccss.js.uncompressed.js | |
parent | 70db7424e7068701e60cc5bcdfe8f858be508179 (diff) | |
parent | c670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dojo/hccss.js.uncompressed.js')
-rw-r--r-- | lib/dojo/hccss.js.uncompressed.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/dojo/hccss.js.uncompressed.js b/lib/dojo/hccss.js.uncompressed.js new file mode 100644 index 000000000..feb953968 --- /dev/null +++ b/lib/dojo/hccss.js.uncompressed.js @@ -0,0 +1,54 @@ +define("dojo/hccss", [ + "require", // require.toUrl + "./_base/config", // config.blankGif + "./dom-class", // domClass.add + "./dom-style", // domStyle.getComputedStyle + "./has", + "./ready", // ready + "./_base/window" // win.body +], function(require, config, domClass, domStyle, has, ready, win){ + + // module: + // dojo/hccss + + /*===== + return function(){ + // summary: + // Test if computer is in high contrast mode (i.e. if browser is not displaying background images). + // Defines `has("highcontrast")` and sets `dj_a11y` CSS class on `<body>` if machine is in high contrast mode. + // Returns `has()` method; + }; + =====*/ + + // Has() test for when background images aren't displayed. Don't call has("highcontrast") before dojo/domReady!. + has.add("highcontrast", function(){ + // note: if multiple documents, doesn't matter which one we use + var div = win.doc.createElement("div"); + div.style.cssText = "border: 1px solid; border-color:red green; position: absolute; height: 5px; top: -999px;" + + "background-image: url(" + (config.blankGif || require.toUrl("./resources/blank.gif")) + ");"; + win.body().appendChild(div); + + var cs = domStyle.getComputedStyle(div), + bkImg = cs.backgroundImage, + hc = (cs.borderTopColor == cs.borderRightColor) || + (bkImg && (bkImg == "none" || bkImg == "url(invalid-url:)" )); + + if(has("ie") <= 8){ + div.outerHTML = ""; // prevent mixed-content warning, see http://support.microsoft.com/kb/925014 + }else{ + win.body().removeChild(div); + } + + return hc; + }); + + // Priority is 90 to run ahead of parser priority of 100. For 2.0, remove the ready() call and instead + // change this module to depend on dojo/domReady! + ready(90, function(){ + if(has("highcontrast")){ + domClass.add(win.body(), "dj_a11y"); + } + }); + + return has; +}); |