Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix: jQuery migrate warning on display length initial setting

- jQuery migrate gives a warning about the use of `attr` rather than
  `prop`. However, we should really just be using `val` here - much
  easier.

- Thread: 13931
  • Loading branch information...
commit f35801b11181a3667fde2e53dfcf36ec875e2de8 1 parent 8045c74
@DataTables authored
Showing with 6 additions and 12 deletions.
  1. +3 −6 media/js/jquery.dataTables.js
  2. +3 −6 media/src/core/core.length.js
View
9 media/js/jquery.dataTables.js
@@ -2689,12 +2689,9 @@
nLength.className = oSettings.oClasses.sLength;
nLength.innerHTML = '<label>'+oSettings.oLanguage.sLengthMenu.replace( '_MENU_', sStdMenu )+'</label>';
- /*
- * Set the length to the current display length - thanks to Andrea Pavlovic for this fix,
- * and Stefan Skopnik for fixing the fix!
- */
- $('select option[value="'+oSettings._iDisplayLength+'"]', nLength).attr("selected", true);
-
+ /* Set the length to the current display length */
+ $('select', nLength).val( oSettings._iDisplayLength );
+
$('select', nLength).bind( 'change.DT', function(e) {
var iVal = $(this).val();
View
9 media/src/core/core.length.js
@@ -44,12 +44,9 @@ function _fnFeatureHtmlLength ( oSettings )
nLength.className = oSettings.oClasses.sLength;
nLength.innerHTML = '<label>'+oSettings.oLanguage.sLengthMenu.replace( '_MENU_', sStdMenu )+'</label>';
- /*
- * Set the length to the current display length - thanks to Andrea Pavlovic for this fix,
- * and Stefan Skopnik for fixing the fix!
- */
- $('select option[value="'+oSettings._iDisplayLength+'"]', nLength).attr("selected", true);
-
+ /* Set the length to the current display length */
+ $('select', nLength).val( oSettings._iDisplayLength );
+
$('select', nLength).bind( 'change.DT', function(e) {
var iVal = $(this).val();
Please sign in to comment.
Something went wrong with that request. Please try again.