New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkboxradio: label of checkbox on external panel is not found #7292

Closed
frequent opened this Issue Apr 2, 2014 · 0 comments

Comments

Projects
None yet
2 participants
@frequent
Contributor

frequent commented Apr 2, 2014

Inside the checkboxradio widget the following code is run:

label = parentLabel.length ? parentLabel :
        input
          .closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog') )
          .find( "label" )
          .filter( "[for='" + escapeId( input[0].id ) + "']" )
          .first(),

If the checkbox is inside an external panel and happens to be outside of a form/fieldset, the bindings on the label will not be set.

Can be fixed by appending , :jqmData(role='panel')" to the selector but I'm also wondering whether checking siblings makes more sense to identify the label than crawling the document altogether. I cannot think of too many use cases where the label is out in the wild.

@gabrielschulhof gabrielschulhof added this to the 1.4.3 milestone Apr 2, 2014

@gabrielschulhof gabrielschulhof self-assigned this Apr 2, 2014

gabrielschulhof added a commit that referenced this issue Apr 3, 2014

Checkboxradio: Rely more on native means of getting the label
Improves performance a great deal when the .labels property is supported, and
also improves performance when such a property is not supported (FF27).

http://jsperf.com/checkboxradio-label-retrieval-non-nested/5

Closes gh-7293
Fixes gh-7292

gabrielschulhof added a commit that referenced this issue Apr 3, 2014

Checkboxradio: Rely more on native means of getting the label
Improves performance a great deal when the .labels property is supported, and
also improves performance when such a property is not supported (FF27).

http://jsperf.com/checkboxradio-label-retrieval-non-nested/5

Closes gh-7293
Fixes gh-7292

gabrielschulhof added a commit that referenced this issue May 29, 2014

Checkboxradio: Correctly retrieve label
This moves label-finding code into one function to help render the code
unit-testable. The new code also relies more on native means of getting the
label, which improves performance a great deal when the .labels property is
supported, and also improves performance when such a property is not supported
(such as in FF27).

http://jsperf.com/checkboxradio-label-retrieval-non-nested/5

(cherry picked from commit d9f5d21)

Closes gh-7293
Fixes gh-7292

agcolom added a commit to agcolom/jquery-mobile that referenced this issue Nov 26, 2014

Checkboxradio: Correctly retrieve label
This moves label-finding code into one function to help render the code
unit-testable. The new code also relies more on native means of getting the
label, which improves performance a great deal when the .labels property is
supported, and also improves performance when such a property is not supported
(such as in FF27).

http://jsperf.com/checkboxradio-label-retrieval-non-nested/5

Closes gh-7293
Fixes gh-7292
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment