Skip to content

Commit

Permalink
Editable: Minor code simplification by removing the parent class chec…
Browse files Browse the repository at this point in the history
…k. On cancel click, the target element could be a children of cancelClass if a link, not anymore; on submit click, we didn't need that verification anyway.
  • Loading branch information
rxaviers committed Oct 24, 2011
1 parent d9f961b commit f534d9c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ui/jquery.ui.editable.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ $.widget( "ui.editable", {
var $this = $( event.target );

if ( !this._editing ) {}
else if ( $this.hasClass( saveClass ) || $this.parent().hasClass( saveClass ) ) {
else if ( $this.hasClass( saveClass ) ) {
this.submit();
return false;
}
else if ( $this.hasClass( cancelClass ) || $this.parent().hasClass( cancelClass ) ) {
else if ( $this.hasClass( cancelClass ) ) {
this._cancel( event );
return false;
}
Expand Down Expand Up @@ -228,9 +228,7 @@ $.ui.editable.cancelButtons = {
return $( "<a></a>" )
.attr( "href", "#" )
.attr( "title", editable.options.cancel.text )
.append( $( "<span></span>" )
.addClass( cancelIconClass )
.html( editable.options.cancel.text ));
.html( editable.options.cancel.text );
}
};

Expand Down

0 comments on commit f534d9c

Please sign in to comment.