MDL-43538 Javascript: Deprecate callback argument to confirm_action

As a precursor to deprecating M.util.show_confirm, this deprecates the
callback argment to the confirm_action class.

This is not currently used anywhere in core, and it's use leads to use of
eval in Javascript.
This commit is contained in:
Andrew Nicols
2014-01-02 14:58:31 +08:00
parent 9788e26805
commit 1d98ca14eb
3 changed files with 14 additions and 5 deletions

View File

@ -256,12 +256,12 @@ M.util.show_confirm_dialog = function(e, args) {
simpledialog.hide();
if (args.callback) {
// args comes from PHP, so callback will be a string, needs to be evaluated by JS
var callback = null;
if (Y.Lang.isFunction(args.callback)) {
callback = args.callback;
} else {
callback = eval('('+args.callback+')');
Y.log('Callbacks to show_confirm_dialog must now be functions. Please update your code to pass in a function instead.',
'warn', 'M.util.show_confirm_dialog');
}
if (Y.Lang.isObject(args.scope)) {