Merge branch 'MDL-24521' of git://github.com/samhemelryk/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2011-01-10 23:20:30 +01:00
commit ff14fd71fd

View file

@ -262,15 +262,17 @@ M.util.show_confirm_dialog = function(e, args) {
return;
}
if (target.get('tagName').toLowerCase() == 'a') {
var targetancestor = null,
targetform = null;
if (target.test('a')) {
window.location = target.get('href');
} else if (target.get('tagName').toLowerCase() == 'input') {
var parentelement = target.get('parentNode');
while (parentelement.get('tagName').toLowerCase() != 'form' && parentelement.get('tagName').toLowerCase() != 'body') {
parentelement = parentelement.get('parentNode');
}
if (parentelement.get('tagName').toLowerCase() == 'form') {
parentelement.submit();
} else if ((targetancestor = target.ancestor('a')) !== null) {
window.location = targetancestor.get('href');
} else if (target.test('input')) {
targetform = target.ancestor('form');
if (targetform && targetform.submit) {
targetform.submit();
}
} 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");