jQuery-File-Upload icon indicating copy to clipboard operation
jQuery-File-Upload copied to clipboard

$.type is deprecated

Open melloware opened this issue 3 years ago • 2 comments

Using $.type is deprecated according to the jQuery Migration 3.3.2 tool.

See: https://github.com/jquery/jquery-migrate/blob/main/warnings.md#jqmigrate-jquerytype-is-deprecated

Cause: This method returns a string that indicates the type of the argument, for example "number" or "function". However, as the JavaScript language evolves this method has become problematic because new language constructs might require this function to either return a new string (potentially breaking existing code) or somehow map new constructs into existing strings (again, potentially breaking existing code). Examples of new recent JavaScript features include asynchronous functions, class constructors, Symbols, or functions that act as iterators.

Solution: Review code that uses jQuery.type() and use a type check that is appropriate for the situation. For example. if the code expects a plain function, check for typeof arg === "function".

melloware avatar Sep 05 '21 12:09 melloware

Sorry, I closed this in error thinking that it relates to #3666, which is however a slightly different problem.

In any way, thanks for your report! I'm still considering if I will support newer jQuery versions at all, but I'll leave this open for now.

blueimp avatar Sep 25 '21 04:09 blueimp

@blueimp no problem I just wanted you aware. I think it will be remove entirely in Jquery 4.0 I have removed it everywhere in my projects for the above Vanilla JS just to make our code forward and backward compatible. Thanks for your consideration!

melloware avatar Sep 25 '21 11:09 melloware