From e16c0b9da677b1c0b3abd0b687f27111426ff725 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 8 Dec 2011 17:50:11 +0000 Subject: [PATCH] MDL-30660 javascript-static: M.util.show_confirm_dialog fixes --- lib/javascript-static.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 5bbc9c3e5e9..49fce0f423d 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -263,13 +263,26 @@ M.util.show_confirm_dialog = function(e, args) { if (target.test('a')) { window.location = target.get('href'); + } 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(); + if (!targetform) { + return; } + if (target.get('name') && target.get('value')) { + targetform.append(''); + } + 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) { alert("Element of type " + target.get('tagName') + " is not supported by the M.util.show_confirm_dialog function. Use A or INPUT"); } -- 2.43.0