Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Button: input inside label fix for ticket #6063 #777

Closed
wants to merge 1 commit into from

2 participants

@fajan

Button: input inside label fix.
Ticket #6063: Labels with implicit controls are not converted to buttons.

So far it works for in Chrome (18.0.1025), FF (16.0.1), Opera (12.02).
Ticket: http://bugs.jqueryui.com/ticket/6063

(I never used Git before, so hope everything is okay with the patch submitting)

@fajan fajan Button: input inside label fix for ticket #6063
Button: input inside label fix.
Ticket #6063: Labels with implicit controls are not converted to buttons.

So far it works for in Chrome (18.0.1025), FF (16.0.1), Opera (12.02).
a0636f1
@jzaefferer
Owner

Thanks for the patch, but reviewing the underlying ticket we closed it as wontfix, see my comment there: http://bugs.jqueryui.com/ticket/6063#comment:13

@jzaefferer jzaefferer closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 17, 2012
  1. @fajan

    Button: input inside label fix for ticket #6063

    fajan authored
    Button: input inside label fix.
    Ticket #6063: Labels with implicit controls are not converted to buttons.
    
    So far it works for in Chrome (18.0.1025), FF (16.0.1), Opera (12.02).
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 1 deletion.
  1. +12 −1 ui/jquery.ui.button.js
View
13 ui/jquery.ui.button.js
@@ -213,7 +213,7 @@ $.widget( "ui.button", {
},
_determineButtonType: function() {
- var ancestor, labelSelector, checked;
+ var ancestor, labelSelector, checked, tempElement;
if ( this.element.is("[type=checkbox]") ) {
this.type = "checkbox";
@@ -236,6 +236,17 @@ $.widget( "ui.button", {
this.buttonElement = ancestor.filter( labelSelector );
if ( !this.buttonElement.length ) {
this.buttonElement = ancestor.find( labelSelector );
+ if ( !this.buttonElement.length ) {
+ ancestor = this.element.parents('label:first');
+ if (ancestor.length){
+ this.element.detach();
+ tempElement = this.element;
+ setTimeout(function(){
+ ancestor.prepend(tempElement);
+ },1);
+ this.buttonElement = ancestor;
+ }
+ }
}
}
this.element.addClass( "ui-helper-hidden-accessible" );
Something went wrong with that request. Please try again.