Bug 1450345 - prevent form submission for <button> element. r=jorgk a=jorgk
--- a/mail/base/content/contentAreaClick.js
+++ b/mail/base/content/contentAreaClick.js
@@ -2,16 +2,18 @@
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Extract the href from the link click event.
* We look for HTMLAnchorElement, HTMLAreaElement, HTMLLinkElement,
* HTMLInputElement.form.action, and nested anchor tags.
+ * If the clicked element was a HTMLInputElement or HTMLButtonElement
+ * we return the form action.
*
* @return href for the url being clicked
*/
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
function hRefForClickEvent(aEvent, aDontCheckInputElement)
@@ -30,17 +32,18 @@
}
else if (target instanceof HTMLImageElement &&
target.hasAttribute("overflowing"))
{
// Return if an image is zoomed, otherwise fall through to see if it has
// a link node.
return href;
}
- else if (!aDontCheckInputElement && target instanceof HTMLInputElement)
+ else if (!aDontCheckInputElement && ((target instanceof HTMLInputElement) ||
+ (target instanceof HTMLButtonElement)))
{
if (target.form && target.form.action)
href = target.form.action;
}
else
{
// We may be nested inside of a link node.
var linkNode = aEvent.originalTarget;