-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Labels
Description
Expected behaviour
Deprecated function should run it's alias, and not error. Deprecated message should appear in console.
Actual behaviour
Error is thrown; $.fn.datepicker.deprecated not a function
Datepicker version used
1.8 - however, issue is still present in latest version - if any methods use the deprecated message.
Example code
var datepicker = $.fn.datepicker.noConflict();
$.fn.bootstrapDP = datepicker;
$('.datepicker').bootstrapDP({options});
$('.datepicker').bootstrapDP('remove');
Reason why issue is occuring
Deprecated function is being assigned to datepicker:
$.fn.datepicker.deprecated = function(msg){
var console = window.console;
if (console && console.warn) {
console.warn('DEPRECATED: ' + msg);
}
};
No conflict is reverting the datepicker function:
$.fn.datepicker.noConflict = function(){
$.fn.datepicker = old;
return this;
};
Alias function is referring to datepicker - which has since been reverted (i.e. no deprecated function exists):
function alias(method, deprecationMsg){
return function(){
if (deprecationMsg !== undefined) {
$.fn.datepicker.deprecated(deprecationMsg);
}
return this[method].apply(this, arguments);
};
}