aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.core.js47
-rw-r--r--ui/ui.dialog.js4
-rw-r--r--ui/ui.progressbar.js14
3 files changed, 30 insertions, 35 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js
index de628a94d..5c4f481eb 100644
--- a/ui/ui.core.js
+++ b/ui/ui.core.js
@@ -108,6 +108,27 @@ $.ui = {
}
};
+// WAI-ARIA normalization
+// tweak $.attr for FF2 implementation
+if (isFF2){
+
+var attr = $.attr;
+$.attr = function(elem, name, value) {
+ var set = value !== undefined,
+ state = /^aria-/;
+
+ return (name == 'role'
+ ? (set
+ ? attr.call(this, elem, name, "wairole:" + value)
+ : (attr.apply(this, arguments) || "").replace(/^wairole:/, ""))
+ : (state.test(name)
+ ? (set
+ ? elem.setAttributeNS("http://www.w3.org/2005/07/aaa", name.replace(state, "aaa:"), value)
+ : attr.call(this, elem, name.replace(state, "aaa:")))
+ : attr.apply(this,arguments)));
+};
+
+}
//jQuery plugins
$.fn.extend({
@@ -133,32 +154,6 @@ $.fn.extend({
.attr('unselectable', 'on')
.css('MozUserSelect', 'none')
.bind('selectstart.ui', function() { return false; });
- },
-
- // WAI-ARIA Semantics
- ariaRole: function(role) {
- return (role !== undefined
-
- // setter
- ? this.attr("role", isFF2 ? "wairole:" + role : role)
-
- // getter
- : (this.attr("role") || "").replace(/^wairole:/, ""));
- },
-
- ariaState: function(state, value) {
- return (value !== undefined
-
- // setter
- ? this.each(function(i, el) {
- (isFF2
- ? el.setAttributeNS("http://www.w3.org/2005/07/aaa",
- "aaa:" + state, value)
- : $(el).attr("aria-" + state, value));
- })
-
- // getter
- : this.attr(isFF2 ? "aaa:" + state : "aria-" + state));
}
});
diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js
index c940f657d..22ed2bb18 100644
--- a/ui/ui.dialog.js
+++ b/ui/ui.dialog.js
@@ -83,8 +83,8 @@ $.widget("ui.dialog", {
(options.closeOnEscape && ev.keyCode
&& ev.keyCode == $.keyCode.ESCAPE && self.close());
})
- .ariaRole("dialog")
- .ariaState("labelledby", titleId)
+ .attr("role","dialog")
+ .attr("aria-labelledby", titleId)
.mouseup(function() {
self.moveToTop();
}),
diff --git a/ui/ui.progressbar.js b/ui/ui.progressbar.js
index e2266ea68..4f4fead64 100644
--- a/ui/ui.progressbar.js
+++ b/ui/ui.progressbar.js
@@ -25,10 +25,10 @@ $.widget("ui.progressbar", {
this.element
.addClass("ui-progressbar")
.width(options.width)
- .ariaRole("progressbar")
- .ariaState("valuemin","0")
- .ariaState("valuemax","100")
- .ariaState("valuenow","0");
+ .attr("role","progressbar")
+ .attr("aria-valuemin","0")
+ .attr("aria-valuemax","100")
+ .attr("aria-valuenow","0");
$.extend(this, {
active: false,
@@ -103,13 +103,13 @@ $.widget("ui.progressbar", {
disable: function() {
this.element.addClass("ui-progressbar-disabled");
this.disabled = true;
- this.element.ariaState("disabled", true);
+ this.element.attr("aria-disabled", true);
},
enable: function() {
this.element.removeClass("ui-progressbar-disabled");
this.disabled = false;
- this.element.ariaState("disabled", false);
+ this.element.attr("aria-disabled", false);
},
pause: function() {
@@ -132,7 +132,7 @@ $.widget("ui.progressbar", {
if (this.options.range && !this.options.text) {
this.textElement.html(percent + '%');
}
- this.element.ariaState("valuenow", percent);
+ this.element.attr("aria-valuenow", percent);
this._propagate('progress', this.ui());
},