6 Star 10 Fork 0

Gitee 极速下载/dojo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/dojo/dojo
克隆/下载
hccss.js 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
define([
"require", // require, require.toUrl
"./_base/config", // config.blankGif
"./dom-class", // domClass.add
"./dom-style", // domStyle.getComputedStyle
"./has",
"./domReady",
"./_base/window" // win.body
], function(require, config, domClass, domStyle, has, domReady, 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");
try{
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;
return cs.borderTopColor == cs.borderRightColor ||
(bkImg && (bkImg == "none" || bkImg == "url(invalid-url:)" ));
}catch(e){
console.warn("hccss: exception detecting high-contrast mode, document is likely hidden: " + e.toString());
return false;
}finally{
if(has("ie") <= 8){
div.outerHTML = ""; // prevent mixed-content warning, see http://support.microsoft.com/kb/925014
}else{
win.body().removeChild(div);
}
}
});
domReady(function(){
if(has("highcontrast")){
domClass.add(win.body(), "dj_a11y");
}
});
return has;
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mirrors/dojo.git
git@gitee.com:mirrors/dojo.git
mirrors
dojo
dojo
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385