From 2736174b9b77f56824cf5361ff866002a9cd6151 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 21 Aug 2014 02:52:24 +0000 Subject: [PATCH] `media.view.Attachment`: set all of the view attributes in the same hash. See [29299], #23560. git-svn-id: https://develop.svn.wordpress.org/trunk@29562 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-views.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 047693f8e7..00f4cf7e8a 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -4664,9 +4664,14 @@ className: 'attachment', template: media.template('attachment'), - attributes: { - tabIndex: 0, - role: 'checkbox' + attributes: function() { + return { + 'tabIndex': 0, + 'role': 'checkbox', + 'aria-label': this.model.get( 'title' ), + 'aria-checked': false, + 'data-id': this.model.get( 'id' ) + }; }, events: { @@ -4688,11 +4693,6 @@ options = _.defaults( this.options, { rerenderOnModelChange: true } ); - this.$el.attr( { - 'aria-label' : this.model.get( 'title' ), - 'aria-checked': false, - 'data-id' : this.model.get( 'id' ) - } ); if ( options.rerenderOnModelChange ) { this.model.on( 'change', this.render, this ); @@ -4954,7 +4954,8 @@ } // Add 'selected' class to model, set aria-checked to true and make the checkbox tabable. - this.$el.addClass( 'selected' ).attr( 'aria-checked', true ).find( '.check' ).attr( 'tabindex', '0' ); + this.$el.addClass( 'selected' ).attr( 'aria-checked', true ) + .find( '.check' ).attr( 'tabindex', '0' ); }, /** * @param {Backbone.Model} model @@ -4970,7 +4971,7 @@ return; } this.$el.removeClass( 'selected' ).attr( 'aria-checked', false ) - .find( '.check' ).attr( 'tabindex', '-1' ); + .find( '.check' ).attr( 'tabindex', '-1' ); }, /** * @param {Backbone.Model} model