Skip to content
Permalink
Browse files

All: Consolidate `.removeAttr()` calls

Closes gh-1505
  • Loading branch information
scottgonzalez committed Mar 18, 2015
1 parent 8bcd363 commit c16a5e58f9e4c130d15e86898e62707c43877ab4
Showing with 12 additions and 42 deletions.
  1. +2 −8 ui/accordion.js
  2. +1 −2 ui/button.js
  3. +4 −11 ui/menu.js
  4. +1 −5 ui/progressbar.js
  5. +1 −5 ui/spinner.js
  6. +3 −11 ui/tabs.js
@@ -127,21 +127,15 @@ return $.widget( "ui.accordion", {

// clean up headers
this.headers
.removeAttr( "role" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-selected" )
.removeAttr( "aria-controls" )
.removeAttr( "tabIndex" )
.removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
.removeUniqueId();

this._destroyIcons();

// clean up content panels
contents = this.headers.next()
.css( "display", "" )
.removeAttr( "role" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-labelledby" )
.removeAttr( "role aria-hidden aria-labelledby" )
.removeUniqueId();

if ( this.options.heightStyle !== "content" ) {
@@ -253,8 +253,7 @@ $.widget( "ui.button", {
.removeClass( "ui-helper-hidden-accessible" );
this.buttonElement
.removeClass( baseClasses + " ui-state-active " + typeClasses )
.removeAttr( "role" )
.removeAttr( "aria-pressed" )
.removeAttr( "role aria-pressed" )
.html( this.buttonElement.find(".ui-button-text").html() );

if ( !this.hasTitle ) {
@@ -160,24 +160,17 @@ return $.widget( "ui.menu", {

_destroy: function() {
var items = this.element.find( ".ui-menu-item" )
.removeAttr( "role" )
.removeAttr( "aria-disabled" ),
.removeAttr( "role aria-disabled" ),
submenus = items.children( ".ui-menu-item-wrapper" )
.removeUniqueId()
.removeAttr( "tabIndex" )
.removeAttr( "role" )
.removeAttr( "aria-haspopup" );
.removeAttr( "tabIndex role aria-haspopup" );

// Destroy (sub)menus
this.element
.removeAttr( "aria-activedescendant" )
.find( ".ui-menu" ).addBack()
.removeAttr( "role" )
.removeAttr( "tabIndex" )
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-disabled" )
.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
"tabIndex" )
.removeUniqueId()
.show();

@@ -69,11 +69,7 @@ return $.widget( "ui.progressbar", {
},

_destroy: function() {
this.element
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );

this.valueDiv.remove();
},
@@ -488,11 +488,7 @@ return $.widget( "ui.spinner", {
_destroy: function() {
this.element
.prop( "disabled", false )
.removeAttr( "autocomplete" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
.removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );

this.uiSpinner.replaceWith( this.element );
},
@@ -729,23 +729,15 @@ return $.widget( "ui.tabs", {
.unbind( this.eventNamespace );

this.anchors
.removeAttr( "role" )
.removeAttr( "tabIndex" )
.removeAttr( "role tabIndex" )
.removeUniqueId();

this.tabs.add( this.panels ).each( function() {
if ( $.data( this, "ui-tabs-destroy" ) ) {
$( this ).remove();
} else {
$( this )
.removeAttr( "tabIndex" )
.removeAttr( "aria-live" )
.removeAttr( "aria-busy" )
.removeAttr( "aria-selected" )
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-expanded" )
.removeAttr( "role" );
$( this ).removeAttr( "role tabIndex " +
"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
}
} );

0 comments on commit c16a5e5

Please sign in to comment.
You can’t perform that action at this time.