Skip to content

Commit

Permalink
Fix: Length menu language with wrapper element wasn't correctly popul…
Browse files Browse the repository at this point in the history
…ated

* Due to the manipulation of DOM elements rather than strings for the
  length list, the browser was cropping elements which were being cut
  short. Fix is to switch back to string manipulation, which can be done
  easily using the outerHTML property of the DOM element. This is
  supported in all browsers since Firefox 11, so happy to use it here.
* See thread 21170 for more information
  • Loading branch information
Allan Jardine committed May 20, 2014
1 parent 97ab8a3 commit 6e60b4e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions js/core/core.length.js
Expand Up @@ -42,13 +42,12 @@ function _fnFeatureHtmlLength ( settings )
div[0].id = tableId+'_length';
}

var a = settings.oLanguage.sLengthMenu.split(/(_MENU_)/);
div.children().append( a.length > 1 ?
$(a[0]).add(select).add(a[2]) :
a[0]
div.children().append(
settings.oLanguage.sLengthMenu.replace( '_MENU_', select[0].outerHTML )
);

// Can't use `select` variable, as user might provide their own select menu
// Can't use `select` variable as user might provide their own and the
// reference is broken by the use of outerHTML
$('select', div)
.val( settings._iDisplayLength )
.bind( 'change.DT', function(e) {
Expand Down

0 comments on commit 6e60b4e

Please sign in to comment.