mirror of
https://github.com/moodle/moodle.git
synced 2025-07-13 18:36:34 +02:00
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:
@ -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)) {
|
||||
|
Reference in New Issue
Block a user