# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/lib/javascript-static.js
--- moodle/lib/javascript-static.js Base (1.171)
+++ moodle/lib/javascript-static.js Locally Modified (Based On 1.171)
@@ -262,16 +262,18 @@
                 return;
             }
 
-            if (target.get('tagName').toLowerCase() == 'a') {
+            var t = null,
+                f = 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');
+            } else if ((t = target.ancestor('a')) !== null) {
+                window.location = t.get('href');
+            } else if (target.test('input')) {
+                f = target.ancestor('form');
+                if (f && f.submit) {
+                    f.submit();
                 }
-                if (parentelement.get('tagName').toLowerCase() == 'form') {
-                    parentelement.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");
             }
