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 |
|
|
|
11 |
dojo.provide("dojo.a11y");
|
|
|
12 |
dojo.require("dojo.uri.*");
|
|
|
13 |
dojo.require("dojo.html.common");
|
|
|
14 |
dojo.a11y = {imgPath:dojo.uri.moduleUri("dojo.widget", "templates/images"), doAccessibleCheck:true, accessible:null, checkAccessible:function () {
|
|
|
15 |
if (this.accessible === null) {
|
|
|
16 |
this.accessible = false;
|
|
|
17 |
if (this.doAccessibleCheck == true) {
|
|
|
18 |
this.accessible = this.testAccessible();
|
|
|
19 |
}
|
|
|
20 |
}
|
|
|
21 |
return this.accessible;
|
|
|
22 |
}, testAccessible:function () {
|
|
|
23 |
this.accessible = false;
|
|
|
24 |
if (dojo.render.html.ie || dojo.render.html.mozilla) {
|
|
|
25 |
var div = document.createElement("div");
|
|
|
26 |
div.style.backgroundImage = "url(\"" + this.imgPath + "/tab_close.gif\")";
|
|
|
27 |
dojo.body().appendChild(div);
|
|
|
28 |
var bkImg = null;
|
|
|
29 |
if (window.getComputedStyle) {
|
|
|
30 |
var cStyle = getComputedStyle(div, "");
|
|
|
31 |
bkImg = cStyle.getPropertyValue("background-image");
|
|
|
32 |
} else {
|
|
|
33 |
bkImg = div.currentStyle.backgroundImage;
|
|
|
34 |
}
|
|
|
35 |
var bUseImgElem = false;
|
|
|
36 |
if (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)")) {
|
|
|
37 |
this.accessible = true;
|
|
|
38 |
}
|
|
|
39 |
dojo.body().removeChild(div);
|
|
|
40 |
}
|
|
|
41 |
return this.accessible;
|
|
|
42 |
}, setCheckAccessible:function (bTest) {
|
|
|
43 |
this.doAccessibleCheck = bTest;
|
|
|
44 |
}, setAccessibleMode:function () {
|
|
|
45 |
if (this.accessible === null) {
|
|
|
46 |
if (this.checkAccessible()) {
|
|
|
47 |
dojo.render.html.prefixes.unshift("a11y");
|
|
|
48 |
}
|
|
|
49 |
}
|
|
|
50 |
return this.accessible;
|
|
|
51 |
}};
|
|
|
52 |
|