jquery/jquery-ui

$.isFunction present in 3.7, absent in 4.0, jQuery-UI dependency

Closed this issue · 10 comments

Dependency in jquery-ui-1.13.2 thru 1.14.1 on function $.isFunction() which was present in jQuery 3.7.1 but not in 4.0-rc2.

HTML:

<script src=../jQuery-4.0/jquery.min.js></script>
<script src=../jquery-ui-1.14.1/jquery-ui.min.js></script>
<div id=someDiv></div>

JS:

$(main)
function main() {
	$("#someDiv").accordion({
		active: false,
		animate: false,
		collapsible: true,
		heightStyle: "content"
	})
}

Result is "isFunction is not a function". Which is pretty ironic.

mgol commented

jQuery UI 1.14.1 does not depend on $.isFunction so I'm not sure where you got that from. Please share a reproducible test case, preferably on a platform like JS Bin; otherwise, I don't think there's anything we could do here.

This would be material for Cacti for sure...

[root@vmhost3 js]# cd /var/www/html/cacti/include/js
[root@vmhost3 js]# grep -r isFunction * | awk -F":" '{print $1}' | uniq
billboard.js
jquery.colorpicker.js
jquery.js
jquery.tablesorter.js
jquery.timepicker.js

It's a jQuery function of course. Maybe deprecated.

Checking jQuery Migrate and it's included in scope. So, isFunction() was deprecated in jQuery and that means that you need to include the jQuery Migrate add-on to your system (including Cacti) while the various plugins move away from the isFunction() calls to the replacement function if any or use the native (typeof object === 'function') check. Aka, write your own.

Test scripts were offered in the original post.

Include jQuery-Migrate in your example above and it should work.

mgol commented

You haven't shared a reproducible test case that I could run myself and there's nothing in what you shared that would produce such an error.

I'm closing the issue; I think you need programming help with your setup and this place is not the best for this.

It was good to see this case as it indicates why jquery-migrate is so crucial. Glad you guys took the time to maintain it!