From b420cbb3ce9b5c1910ff41a65613e33463f88cd7 Mon Sep 17 00:00:00 2001 From: David Bolter Date: Wed, 5 Nov 2008 19:43:21 +0000 Subject: Tweaking attr to normalize for FF2 ARIA implementation. Removed ariaRole and ariaState API. (Assist: Scott González, Fixes #3529) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/ui.core.js | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) (limited to 'ui/ui.core.js') 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)); } }); -- cgit v1.2.3