Permalink
Browse files

Button: Set button text as title attribute value for icon-only buttons.

  • Loading branch information...
jaspermdegroot committed Apr 23, 2013
1 parent fa8403d commit a53090efe77f068c4036004b41003e60d615c6c4
Showing with 10 additions and 0 deletions.
  1. +10 −0 js/widgets/forms/button.js
View
@@ -126,7 +126,17 @@ $.widget( "mobile.button", $.mobile.widget, {
if ( !o.iconpos ) {
o.iconpos = "left";
}
+
classes += " ui-icon-" + o.icon + " ui-btn-icon-" + o.iconpos;
+
+ if ( o.iconpos === "notext" && !$el.attr( "title" ) ) {
+ if ( $el[ 0 ].tagName === "INPUT" ) {
+ $el.attr( "title", $el.val() );
+ } else {
+ $el.attr( "title", $el.getEncodedText() );
+ }
+ }
+
if ( o.iconshadow ) {
classes += " ui-shadow-icon";
}

0 comments on commit a53090e

Please sign in to comment.