Accept boolean values for aria state. (Thanks for catch Scott González)

This commit is contained in:
David Bolter 2008-09-22 18:21:38 +00:00
parent fb3a5d4010
commit 5f9ffb28d3
2 changed files with 3 additions and 3 deletions

View File

@ -64,8 +64,8 @@ test("aria", function() {
equals($('#aria').ariaRole(), 'tablist', 'role is tablist via ariaRole');
ok(!$('#aria').attr('expanded'), 'state expanded absent via attr');
ok(!$('#aria').ariaState('expanded'), 'state expanded absent via ariaState');
equals($('#aria').ariaState('expanded', 'true').ariaState('expanded'), 'true', 'aria expanded is true');
equals($('#aria').ariaState('expanded', 'false').ariaState('expanded'), 'false', 'aria expanded is false');
equals($('#aria').ariaState('expanded', true).ariaState('expanded'), 'true', 'aria expanded is true');
equals($('#aria').ariaState('expanded', false).ariaState('expanded'), 'false', 'aria expanded is false');
});
})(jQuery);

View File

@ -454,7 +454,7 @@ $.fn.extend({
ariaState : function(state, value) {
// setter?
if (value)
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);