1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
1422 |
alexandre_ |
11 |
|
|
|
12 |
|
1318 |
alexandre_ |
13 |
dojo.provide("dojo.a11y");
|
|
|
14 |
dojo.require("dojo.uri.*");
|
|
|
15 |
dojo.require("dojo.html.common");
|
|
|
16 |
dojo.a11y = {imgPath:dojo.uri.moduleUri("dojo.widget", "templates/images"), doAccessibleCheck:true, accessible:null, checkAccessible:function () {
|
|
|
17 |
if (this.accessible === null) {
|
|
|
18 |
this.accessible = false;
|
|
|
19 |
if (this.doAccessibleCheck == true) {
|
|
|
20 |
this.accessible = this.testAccessible();
|
|
|
21 |
}
|
|
|
22 |
}
|
|
|
23 |
return this.accessible;
|
|
|
24 |
}, testAccessible:function () {
|
|
|
25 |
this.accessible = false;
|
|
|
26 |
if (dojo.render.html.ie || dojo.render.html.mozilla) {
|
|
|
27 |
var div = document.createElement("div");
|
|
|
28 |
div.style.backgroundImage = "url(\"" + this.imgPath + "/tab_close.gif\")";
|
|
|
29 |
dojo.body().appendChild(div);
|
|
|
30 |
var bkImg = null;
|
|
|
31 |
if (window.getComputedStyle) {
|
|
|
32 |
var cStyle = getComputedStyle(div, "");
|
|
|
33 |
bkImg = cStyle.getPropertyValue("background-image");
|
|
|
34 |
} else {
|
|
|
35 |
bkImg = div.currentStyle.backgroundImage;
|
|
|
36 |
}
|
|
|
37 |
var bUseImgElem = false;
|
|
|
38 |
if (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)")) {
|
|
|
39 |
this.accessible = true;
|
|
|
40 |
}
|
|
|
41 |
dojo.body().removeChild(div);
|
|
|
42 |
}
|
|
|
43 |
return this.accessible;
|
|
|
44 |
}, setCheckAccessible:function (bTest) {
|
|
|
45 |
this.doAccessibleCheck = bTest;
|
|
|
46 |
}, setAccessibleMode:function () {
|
|
|
47 |
if (this.accessible === null) {
|
|
|
48 |
if (this.checkAccessible()) {
|
|
|
49 |
dojo.render.html.prefixes.unshift("a11y");
|
|
|
50 |
}
|
|
|
51 |
}
|
|
|
52 |
return this.accessible;
|
|
|
53 |
}};
|
|
|
54 |
|