Ticket #3529: 3529.2.diff
| File 3529.2.diff, 4.4 KB (added by davidb, 22 months ago) |
|---|
|
updated (thanks Scott!) |
-
tests/progressbar.js
56 56 expect(7); 57 57 el = $("#progressbar").progressbar(); 58 58 59 equals(el.a riaRole(), "progressbar", "aria role");60 equals(el.a riaState("valuemin"), 0, "aria-valuemin");61 equals(el.a riaState("valuemax"), 100, "aria-valuemax");62 equals(el.a riaState("valuenow"), 0, "aria-valuenow initially");59 equals(el.attr("role"), "progressbar", "aria role"); 60 equals(el.attr("aria-valuemin"), 0, "aria-valuemin"); 61 equals(el.attr("aria-valuemax"), 100, "aria-valuemax"); 62 equals(el.attr("aria-valuenow"), 0, "aria-valuenow initially"); 63 63 el.progressbar("progress", 77); 64 equals(el.a riaState("valuenow"), 77, "aria-valuenow");64 equals(el.attr("aria-valuenow"), 77, "aria-valuenow"); 65 65 el.progressbar("disable"); 66 equals(el.a riaState("disabled"), "true", "aria-disabled");66 equals(el.attr("aria-disabled"), "true", "aria-disabled"); 67 67 el.progressbar("enable"); 68 equals(el.a riaState("disabled"), "false", "enabled");68 equals(el.attr("aria-disabled"), "false", "enabled"); 69 69 }); 70 70 71 71 })(jQuery); -
ui/ui.core.js
108 108 } 109 109 }; 110 110 111 // WAI-ARIA normalization 112 // tweak $.attr for FF2 implementation 113 if (isFF2){ 111 114 115 var attr = $.attr; 116 $.attr = function(elem, name, value) { 117 var set = value !== undefined, 118 state = /^aria-/; 119 120 return (name == 'role' 121 ? (set 122 ? attr.call(this, elem, name, "wairole:" + value) 123 : (attr.apply(this, arguments) || "").replace(/^wairole:/, "")) 124 : (state.test(name) 125 ? (set 126 ? elem.setAttributeNS("http://www.w3.org/2005/07/aaa", name.replace(state, "aaa:"), value) 127 : attr.call(this, elem, name.replace(state, "aaa:"))) 128 : attr.apply(this,arguments))); 129 }; 130 131 } 132 112 133 //jQuery plugins 113 134 $.fn.extend({ 114 135 … … 133 154 .attr('unselectable', 'on') 134 155 .css('MozUserSelect', 'none') 135 156 .bind('selectstart.ui', function() { return false; }); 136 },137 138 // WAI-ARIA Semantics139 ariaRole: function(role) {140 return (role !== undefined141 142 // setter143 ? this.attr("role", isFF2 ? "wairole:" + role : role)144 145 // getter146 : (this.attr("role") || "").replace(/^wairole:/, ""));147 },148 149 ariaState: function(state, value) {150 return (value !== undefined151 152 // setter153 ? this.each(function(i, el) {154 (isFF2155 ? el.setAttributeNS("http://www.w3.org/2005/07/aaa",156 "aaa:" + state, value)157 : $(el).attr("aria-" + state, value));158 })159 160 // getter161 : this.attr(isFF2 ? "aaa:" + state : "aria-" + state));162 157 } 163 158 164 159 }); -
ui/ui.progressbar.js
25 25 this.element 26 26 .addClass("ui-progressbar") 27 27 .width(options.width) 28 .a riaRole("progressbar")29 .a riaState("valuemin","0")30 .a riaState("valuemax","100")31 .a riaState("valuenow","0");28 .attr("role","progressbar") 29 .attr("aria-valuemin","0") 30 .attr("aria-valuemax","100") 31 .attr("aria-valuenow","0"); 32 32 33 33 $.extend(this, { 34 34 active: false, … … 103 103 disable: function() { 104 104 this.element.addClass("ui-progressbar-disabled"); 105 105 this.disabled = true; 106 this.element.a riaState("disabled", true);106 this.element.attr("aria-disabled", true); 107 107 }, 108 108 109 109 enable: function() { 110 110 this.element.removeClass("ui-progressbar-disabled"); 111 111 this.disabled = false; 112 this.element.a riaState("disabled", false);112 this.element.attr("aria-disabled", false); 113 113 }, 114 114 115 115 pause: function() { … … 132 132 if (this.options.range && !this.options.text) { 133 133 this.textElement.html(percent + '%'); 134 134 } 135 this.element.a riaState("valuenow", percent);135 this.element.attr("aria-valuenow", percent); 136 136 this._propagate('progress', this.ui()); 137 137 }, 138 138 -
ui/ui.dialog.js
83 83 (options.closeOnEscape && ev.keyCode 84 84 && ev.keyCode == $.keyCode.ESCAPE && self.close()); 85 85 }) 86 .a riaRole("dialog")87 .a riaState("labelledby", titleId)86 .attr("role","dialog") 87 .attr("aria-labelledby", titleId) 88 88 .mouseup(function() { 89 89 self.moveToTop(); 90 90 }),
![(please configure the [header_logo] section in trac.ini)](/chrome/site/nologo.gif)