Is this actually a DataTables issue or is this something else?

Is this actually a DataTables issue or is this something else?

hahn74hahn74 Posts: 2Questions: 1Answers: 0

I'm upgrading jQuery to 3.5.1 using the migrate 3.3.0 tool, and also to DataTables 1.10.21 and I keep seeing these deprecation warnings from the migrate tool. It looks like it might be happening in DataTables. It's just a warning so it's not breaking the page, but is this something I need to address in DataTables?

jquery-migrate-3.3.0.js:100 JQMIGRATE: jQuery.isArray is deprecated; use Array.isArray
jquery-migrate-3.3.0.js:102 console.trace
migrateWarn @ jquery-migrate-3.3.0.js:102
obj.<computed> @ jquery-migrate-3.3.0.js:125
t @ datatables.min.js:129
(anonymous) @ datatables.min.js:131
(anonymous) @ datatables.min.js:30
(anonymous) @ datatables.min.js:30

jquery-migrate-3.3.0.js:100 JQMIGRATE: jQuery.trim is deprecated; use String.prototype.trim
jquery-migrate-3.3.0.js:102 console.trace
migrateWarn @ jquery-migrate-3.3.0.js:102
obj.<computed> @ jquery-migrate-3.3.0.js:125
u @ datatables.min.js:48
La @ datatables.min.js:49
(anonymous) @ datatables.min.js:42
(anonymous) @ jquery-3.5.1.js:208
map @ jquery-3.5.1.js:463
map @ jquery-3.5.1.js:207
oa @ datatables.min.js:42
e @ datatables.min.js:118
(anonymous) @ datatables.min.js:119
each @ jquery-3.5.1.js:381
each @ jquery-3.5.1.js:203
q @ datatables.min.js:109
f.fn.DataTable @ datatables.min.js:192
(anonymous) @ 00001:6177
mightThrow @ jquery-3.5.1.js:3762
process @ jquery-3.5.1.js:3830
setTimeout (async)
(anonymous) @ jquery-3.5.1.js:3868
fire @ jquery-3.5.1.js:3496
fireWith @ jquery-3.5.1.js:3626
fire @ jquery-3.5.1.js:3634
fire @ jquery-3.5.1.js:3496
fireWith @ jquery-3.5.1.js:3626
ready @ jquery-3.5.1.js:4106
completed @ jquery-3.5.1.js:4116

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    is this something I need to address in DataTables?

    No - it is something I need to address :). We'll do a 1.10.22 release in the not too distant future to address that.

    Thanks,
    Allan

  • hahn74hahn74 Posts: 2Questions: 1Answers: 0

    Thanks!

  • bitwisebitwise Posts: 2Questions: 0Answers: 0

    Started working through migration to jQuery 3.5.1 as well. Finally found this post. I think the bigger issue may actually be jQuery UI 1.12.1 there as not been a release in a long while (I could be wrong).

    Any idea on when the fix will be released for datatables?

    Thanks! Below is what I did to fix the issue temporarily.

    I did update datatables.js at line 62641
    contents = $.trim(cell.innerHTML);

    TO

    contents = (cell.innerHTML).trim();

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    contents = (cell.innerHTML).trim();

    Good fix. We currently support back to IE8 though, which doesn’t support that method. We’ll probably change that support level with the next major iteration of DataTables though (or a polyfill can be used).

    Any idea on when the fix will be released for datatables?

    Probably next month sometime. We are currently on a bi-monthly cadence for DataTables releases.

    Allan

  • bitwisebitwise Posts: 2Questions: 0Answers: 0

    I missed another issue that is also mentioned in the original post.

    JQMIGRATE: jQuery.isArray is deprecated; use Array.isArray

    In datatables.min.js I did a find (f.isArray) and replace (Array.isArray) that seemed to get rid of the JQMIGRATE message.

    I was not sure what to do in datatables.js as I found (line: 9264):
    function isArray(variable) { return Array.isArray(variable); }

    My thought was to just change any calls to the isArray function TO Array.isArray. Then I guess the isArray function could be eliminated.

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Yes, we use $.isArray in loads of places since there was no Array.isArray() back in the day.

    Looks like we are going to need to abstract out a lot of our jQuery calls. I'm not certain that will be done for the next release.

    Allan

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    I've raised it internally (DD-1492 for my reference) so we don't forget, and we'll report back here when there's an update.

    Colin

  • dxnidxni Posts: 1Questions: 0Answers: 0
    edited March 2022

    Hi, has there been any update on this? I've upgraded to jQuery to 3.5.1 am also getting these deprecation warnings from the migrate tool (.isArray, .trim, .bind() are all deprecated). Have these been addressed in a recent release?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Yep, those were removed in September 2020, well .isArray and .trim(), I'm not sure about .bind(), so if you upgrade to any of the latest versions those warnings should go.

    Colin

Sign In or Register to comment.