Changeset 941
- Timestamp:
- 11/14/08 20:29:08 (16 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
tests/core.js (modified) (1 diff)
-
ui/ui.core.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/core.js
r930 r941 57 57 58 58 test("attr - aria", function() { 59 expect( 4);59 expect(6); 60 60 61 ok(!$('#aria').attr('role'), 'role is empty via attr'); 62 equals($('#aria').attr('role', 'tablist').attr('role'), 'tablist', 'role is tablist'); 63 equals($('#aria').attr('aria-expanded', true).attr('aria-expanded'), 'true', 'aria expanded is true'); 64 equals($('#aria').attr('aria-expanded', false).attr('aria-expanded'), 'false', 'aria expanded is false'); 61 var el = $('#aria'); 62 63 ok(!el.attr('role'), 'role is empty via attr'); 64 equals(el.attr('role', 'tablist').attr('role'), 'tablist', 'role is tablist'); 65 66 equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined'); 67 68 el.attr('aria-expanded', true); 69 equals(el.attr('aria-expanded'), 'true', 'aria expanded is true'); 70 71 el.removeAttr('aria-expanded'); 72 equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined after removing'); 73 74 el.attr('aria-expanded', false); 75 equals(el.attr('aria-expanded'), 'false', 'aria expanded is false'); 65 76 }); 66 77 -
trunk/ui/ui.core.js
r933 r941 136 136 137 137 // WAI-ARIA normalization 138 // tweak $.attr for FF2 implementation139 138 if (isFF2) { 140 139 var attr = $.attr, 140 removeAttr = $.fn.removeAttr, 141 ariaNS = "http://www.w3.org/2005/07/aaa", 141 142 ariaState = /^aria-/, 142 143 ariaRole = /^wairole:/; … … 151 152 : (ariaState.test(name) 152 153 ? (set 153 ? elem.setAttributeNS( "http://www.w3.org/2005/07/aaa",154 ? elem.setAttributeNS(ariaNS, 154 155 name.replace(ariaState, "aaa:"), value) 155 156 : attr.call(this, elem, name.replace(ariaState, "aaa:"))) 156 157 : attr.apply(this, arguments))); 158 }; 159 160 $.fn.removeAttr = function(name) { 161 return (ariaState.test(name) 162 ? this.each(function() { 163 this.removeAttributeNS(ariaNS, name.replace(ariaState, "")); 164 }) : removeAttr.call(this, name)); 157 165 }; 158 166 }