Skip to content

Commit c16a5e5

Browse files
committed
All: Consolidate .removeAttr() calls
Closes gh-1505
1 parent 8bcd363 commit c16a5e5

File tree

6 files changed

+12
-42
lines changed

6 files changed

+12
-42
lines changed

ui/accordion.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,15 @@ return $.widget( "ui.accordion", {
127127

128128
// clean up headers
129129
this.headers
130-
.removeAttr( "role" )
131-
.removeAttr( "aria-expanded" )
132-
.removeAttr( "aria-selected" )
133-
.removeAttr( "aria-controls" )
134-
.removeAttr( "tabIndex" )
130+
.removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
135131
.removeUniqueId();
136132

137133
this._destroyIcons();
138134

139135
// clean up content panels
140136
contents = this.headers.next()
141137
.css( "display", "" )
142-
.removeAttr( "role" )
143-
.removeAttr( "aria-hidden" )
144-
.removeAttr( "aria-labelledby" )
138+
.removeAttr( "role aria-hidden aria-labelledby" )
145139
.removeUniqueId();
146140

147141
if ( this.options.heightStyle !== "content" ) {

ui/button.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ $.widget( "ui.button", {
253253
.removeClass( "ui-helper-hidden-accessible" );
254254
this.buttonElement
255255
.removeClass( baseClasses + " ui-state-active " + typeClasses )
256-
.removeAttr( "role" )
257-
.removeAttr( "aria-pressed" )
256+
.removeAttr( "role aria-pressed" )
258257
.html( this.buttonElement.find(".ui-button-text").html() );
259258

260259
if ( !this.hasTitle ) {

ui/menu.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,24 +160,17 @@ return $.widget( "ui.menu", {
160160

161161
_destroy: function() {
162162
var items = this.element.find( ".ui-menu-item" )
163-
.removeAttr( "role" )
164-
.removeAttr( "aria-disabled" ),
163+
.removeAttr( "role aria-disabled" ),
165164
submenus = items.children( ".ui-menu-item-wrapper" )
166165
.removeUniqueId()
167-
.removeAttr( "tabIndex" )
168-
.removeAttr( "role" )
169-
.removeAttr( "aria-haspopup" );
166+
.removeAttr( "tabIndex role aria-haspopup" );
170167

171168
// Destroy (sub)menus
172169
this.element
173170
.removeAttr( "aria-activedescendant" )
174171
.find( ".ui-menu" ).addBack()
175-
.removeAttr( "role" )
176-
.removeAttr( "tabIndex" )
177-
.removeAttr( "aria-labelledby" )
178-
.removeAttr( "aria-expanded" )
179-
.removeAttr( "aria-hidden" )
180-
.removeAttr( "aria-disabled" )
172+
.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
173+
"tabIndex" )
181174
.removeUniqueId()
182175
.show();
183176

ui/progressbar.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ return $.widget( "ui.progressbar", {
6969
},
7070

7171
_destroy: function() {
72-
this.element
73-
.removeAttr( "role" )
74-
.removeAttr( "aria-valuemin" )
75-
.removeAttr( "aria-valuemax" )
76-
.removeAttr( "aria-valuenow" );
72+
this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
7773

7874
this.valueDiv.remove();
7975
},

ui/spinner.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,7 @@ return $.widget( "ui.spinner", {
488488
_destroy: function() {
489489
this.element
490490
.prop( "disabled", false )
491-
.removeAttr( "autocomplete" )
492-
.removeAttr( "role" )
493-
.removeAttr( "aria-valuemin" )
494-
.removeAttr( "aria-valuemax" )
495-
.removeAttr( "aria-valuenow" );
491+
.removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
496492

497493
this.uiSpinner.replaceWith( this.element );
498494
},

ui/tabs.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -729,23 +729,15 @@ return $.widget( "ui.tabs", {
729729
.unbind( this.eventNamespace );
730730

731731
this.anchors
732-
.removeAttr( "role" )
733-
.removeAttr( "tabIndex" )
732+
.removeAttr( "role tabIndex" )
734733
.removeUniqueId();
735734

736735
this.tabs.add( this.panels ).each( function() {
737736
if ( $.data( this, "ui-tabs-destroy" ) ) {
738737
$( this ).remove();
739738
} else {
740-
$( this )
741-
.removeAttr( "tabIndex" )
742-
.removeAttr( "aria-live" )
743-
.removeAttr( "aria-busy" )
744-
.removeAttr( "aria-selected" )
745-
.removeAttr( "aria-labelledby" )
746-
.removeAttr( "aria-hidden" )
747-
.removeAttr( "aria-expanded" )
748-
.removeAttr( "role" );
739+
$( this ).removeAttr( "role tabIndex " +
740+
"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
749741
}
750742
} );
751743

0 commit comments

Comments
 (0)