aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.core.js
diff options
context:
space:
mode:
authorDavid Bolter <david.bolter@gmail.com>2008-09-22 15:47:41 +0000
committerDavid Bolter <david.bolter@gmail.com>2008-09-22 15:47:41 +0000
commitfb3a5d40106a83d10734f203189dc390cfaa0b94 (patch)
tree39b0f4980fe1b4b32edbe961260e80bf2beaa431 /ui/ui.core.js
parentcd8d1b76542dec366da6bf0d4f8bfe9da72be573 (diff)
downloadjquery-ui-fb3a5d40106a83d10734f203189dc390cfaa0b94.tar.gz
jquery-ui-fb3a5d40106a83d10734f203189dc390cfaa0b94.zip
Added ariaRole and ariaState to ui.core with tests.
Added ARIA role and state to ui.dialog Fixes #3350 (Inspired by jARIA plugin from Chris Hoffman)
Diffstat (limited to 'ui/ui.core.js')
-rw-r--r--ui/ui.core.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js
index 2cf48d11f..be0caa920 100644
--- a/ui/ui.core.js
+++ b/ui/ui.core.js
@@ -437,4 +437,31 @@ $.ui.mouse.defaults = {
delay: 0
};
+
+// WAI-ARIA Semantics
+var isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
+$.fn.extend({
+ ariaRole : function(role) {
+ // setter?
+ if (role) {
+ return this.each(function(i, el) {
+ $(el).attr("role", isFF2 ? "wairole:" + role : role);
+ });
+ }
+ // getter just returns first jquery member's role string
+ return (this.eq(0).attr("role") || "").replace(/^wairole:/, "");
+ },
+
+ ariaState : function(state, value) {
+ // setter?
+ if (value)
+ return this.each(function(i, el) {
+ isFF2? el.setAttributeNS("http://www.w3.org/2005/07/aaa", "aaa:" + state, value) :
+ $(el).attr("aria-" + state, value);
+ });
+ // getter
+ return this.attr(isFF2? "aaa:"+state : "aria-" + state);
+ }
+});
+
})(jQuery);