diff options
author | Scott González <scott.gonzalez@gmail.com> | 2008-09-22 20:52:48 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2008-09-22 20:52:48 +0000 |
commit | dd7511c4f914069148f83177991b6a4caf298f53 (patch) | |
tree | cd01f3de50d677a9d881997462903d40a6fe90e6 | |
parent | 5f9ffb28d33588ce006d980dfb07680c5d12f7d5 (diff) | |
download | jquery-ui-dd7511c4f914069148f83177991b6a4caf298f53.tar.gz jquery-ui-dd7511c4f914069148f83177991b6a4caf298f53.zip |
Core: Moved ARIA methods up with other jQuery core modifications.
-rw-r--r-- | ui/ui.core.js | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index 1ac19b7ff..9814dace2 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -94,6 +94,32 @@ $.keyCode = { UP: 38 }; +// 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 !== undefined) + 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); + } +}); + // $.widget is a factory to create jQuery plugins // taking some boilerplate code out of the plugin code // created by Scott González and Jörn Zaefferer @@ -437,31 +463,4 @@ $.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 !== undefined) - 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); |