bootboxjs / bootbox

Wrappers for JavaScript alert(), confirm() and other flexible dialogs using Twitter's bootstrap framework
http://bootboxjs.com
Other
5.04k stars 1.04k forks source link

Removed jQuery deprecations #836

Closed TWithers closed 1 year ago

TWithers commented 1 year ago

Using jQuery Migrate on a project and noticed several deprecations that were being reported from the bootbox library.

$.isArray() was deprecated in jQuery 3.2 $.isFunction() was deprecated in jQuery 3.3 $.type() was deprecated in jQuery 3.3 $.trim() was deprecated in jQuery 3.5

I went in and fixed all the deprecations listed above, with the substitutions below.

$.isFunction(x) became typeof x === "function" !$.isFunction(x) became typeof x !== "function" $.isArray(x) became Array.isArray(x) $.type(x) became typeof x $.trim(x) became x.trim()

tiesont commented 1 year ago

@TWithers Awesome! I'm going to see if we need to test https://github.com/bootboxjs/bootbox/pull/836/files#diff-f575c474c7914f9ce9400a33114971ebd4b992348260a17a7ee8be2ba361e700R869 for null, first - I think if options.message is null then options.message.trim() will cause an error. Everything else looks good, and Karma seems happy.

tiesont commented 1 year ago

@TWithers Needed to make a few tweaks - we have some linting rules that need to be followed, and we need a "null" check on options.message with this update. I made both changes.

For future reference, we do have a test suite that needs to be run and pass for pull-requests to be merged. This and the linter will be run when you run grunt in the terminal.