I have fixed it with checking for the height() method and otherwise parse the ui.panel to a jQuery object:
if (typeof(ui.panel.height) == "function") {
var height = ui.panel.height();
}
else {
var panel = jQuery(ui.panel);
var height = panel.height();
}