aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2008-09-23 00:11:26 +0000
committerScott González <scott.gonzalez@gmail.com>2008-09-23 00:11:26 +0000
commit78a2337faf525e4f8b2919f323e5425c5f6658c7 (patch)
tree0dbb764b8d90581368eed13c22f27bfcaf8a7eed
parentdd7511c4f914069148f83177991b6a4caf298f53 (diff)
downloadjquery-ui-78a2337faf525e4f8b2919f323e5425c5f6658c7.tar.gz
jquery-ui-78a2337faf525e4f8b2919f323e5425c5f6658c7.zip
Core: Reduced size of ARIA methods.
-rw-r--r--ui/ui.core.js39
1 files changed, 21 insertions, 18 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js
index 9814dace2..6450f1752 100644
--- a/ui/ui.core.js
+++ b/ui/ui.core.js
@@ -97,26 +97,29 @@ $.keyCode = {
// 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:/, "");
+ ariaRole: function(role) {
+ return (role !== undefined
+
+ // setter
+ ? this.attr("role", isFF2 ? "wairole:" + role : role)
+
+ // getter
+ : (this.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);
+ 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));
}
});