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

Closed
frequent opened this Issue Apr 2, 2014 · 0 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 gabrielschulhof added a commit that referenced this issue Apr 3, 2014
@gabrielschulhof gabrielschulhof 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
f1848b9
@gabrielschulhof gabrielschulhof added a commit that referenced this issue Apr 3, 2014
@gabrielschulhof gabrielschulhof 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
6776ca0
@gabrielschulhof gabrielschulhof added a commit that closed this issue May 29, 2014
@gabrielschulhof gabrielschulhof 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
d9f5d21
@gabrielschulhof gabrielschulhof added a commit that referenced this issue May 29, 2014
@gabrielschulhof gabrielschulhof 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
dca0976
@agcolom agcolom added a commit to agcolom/jquery-mobile that referenced this issue Nov 26, 2014
@gabrielschulhof @agcolom gabrielschulhof + agcolom 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
dca6002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment