diff options
author | Scott González <scott.gonzalez@gmail.com> | 2016-07-11 12:11:59 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2016-07-12 13:06:23 -0400 |
commit | 55cd9488ccd897bb9b75450852c100d13cf0df02 (patch) | |
tree | d2c2375f48e3fcd63c0fc92c92b413efc3f44058 /ui | |
parent | 21f7f2500c5924f72e46a5678a42756404631ff4 (diff) | |
download | jquery-ui-55cd9488ccd897bb9b75450852c100d13cf0df02.tar.gz jquery-ui-55cd9488ccd897bb9b75450852c100d13cf0df02.zip |
Checkboxradio: Fix label handling with jQuery 3.x
Fixes #15006
Closes gh-1720
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/checkboxradio.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ui/widgets/checkboxradio.js b/ui/widgets/checkboxradio.js index a55e4f033..45500aaf5 100644 --- a/ui/widgets/checkboxradio.js +++ b/ui/widgets/checkboxradio.js @@ -69,7 +69,7 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { // We need to get the label text but this may also need to make sure it does not contain the // input itself. - this.label.contents().not( this.element ).each( function() { + this.label.contents().not( this.element[ 0 ] ).each( function() { // The label contents could be text, html, or a mix. We concat each element to get a // string representation of the label, without the input as part of it. @@ -252,7 +252,15 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { _updateLabel: function() { // Remove the contents of the label ( minus the icon, icon space, and input ) - this.label.contents().not( this.element.add( this.icon ).add( this.iconSpace ) ).remove(); + var contents = this.label.contents().not( this.element[ 0 ] ); + if ( this.icon ) { + contents = contents.not( this.icon[ 0 ] ); + } + if ( this.iconSpace ) { + contents = contents.not( this.iconSpace[ 0 ] ); + } + contents.remove(); + this.label.append( this.options.label ); }, |