mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
MDL-30660 javascript-static: M.util.show_confirm_dialog fixes
This commit is contained in:
parent
01f7f6f9aa
commit
1e92c729ba
1 changed files with 15 additions and 2 deletions
|
@ -263,13 +263,26 @@ M.util.show_confirm_dialog = function(e, args) {
|
||||||
|
|
||||||
if (target.test('a')) {
|
if (target.test('a')) {
|
||||||
window.location = target.get('href');
|
window.location = target.get('href');
|
||||||
|
|
||||||
} else if ((targetancestor = target.ancestor('a')) !== null) {
|
} else if ((targetancestor = target.ancestor('a')) !== null) {
|
||||||
window.location = targetancestor.get('href');
|
window.location = targetancestor.get('href');
|
||||||
|
|
||||||
} else if (target.test('input')) {
|
} else if (target.test('input')) {
|
||||||
targetform = target.ancestor('form');
|
targetform = target.ancestor('form');
|
||||||
if (targetform && targetform.submit) {
|
if (!targetform) {
|
||||||
targetform.submit();
|
return;
|
||||||
}
|
}
|
||||||
|
if (target.get('name') && target.get('value')) {
|
||||||
|
targetform.append('<input type="hidden" name="' + target.get('name') +
|
||||||
|
'" value="' + target.get('value') + '">');
|
||||||
|
}
|
||||||
|
targetform.submit();
|
||||||
|
|
||||||
|
} else if (target.get('tagName').toLowerCase() == 'form') {
|
||||||
|
// We cannot use target.test('form') on the previous line because of
|
||||||
|
// http://yuilibrary.com/projects/yui3/ticket/2531561
|
||||||
|
target.submit();
|
||||||
|
|
||||||
} else if (M.cfg.developerdebug) {
|
} else if (M.cfg.developerdebug) {
|
||||||
alert("Element of type " + target.get('tagName') + " is not supported by the M.util.show_confirm_dialog function. Use A or INPUT");
|
alert("Element of type " + target.get('tagName') + " is not supported by the M.util.show_confirm_dialog function. Use A or INPUT");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue