Bug 910634 - Disabled <input> should not popup a dialog. r=wesj
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Thu, 26 Feb 2015 02:39:00 -0500
changeset 264131 466d2f2a7b7e51cca2ce024a23baeb8723c8ae76
parent 264130 c3681d12e524822bb2125fb8d801c154618c8ec1
child 264132 e6349d80d3b5f6a25a6bcb620679b7da87a95711
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs910634
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 910634 - Disabled <input> should not popup a dialog. r=wesj
mobile/android/chrome/content/InputWidgetHelper.js
--- a/mobile/android/chrome/content/InputWidgetHelper.js
+++ b/mobile/android/chrome/content/InputWidgetHelper.js
@@ -8,17 +8,17 @@ var InputWidgetHelper = {
 
   handleEvent: function(aEvent) {
     this.handleClick(aEvent.target);
   },
 
   handleClick: function(aTarget) {
     // if we're busy looking at a InputWidget we want to eat any clicks that
     // come to us, but not to process them
-    if (this._uiBusy || !this.hasInputWidget(aTarget))
+    if (this._uiBusy || !this.hasInputWidget(aTarget) || this._isDisabledElement(aTarget))
       return;
 
     this._uiBusy = true;
     this.show(aTarget);
     this._uiBusy = false;
   },
 
   show: function(aElement) {
@@ -76,10 +76,21 @@ var InputWidgetHelper = {
   fireOnChange: function(aElement) {
     let evt = aElement.ownerDocument.createEvent("Events");
     evt.initEvent("change", true, true, aElement.defaultView, 0,
                   false, false,
                   false, false, null);
     setTimeout(function() {
       aElement.dispatchEvent(evt);
     }, 0);
+  },
+
+  _isDisabledElement : function(aElement) {
+    let currentElement = aElement;
+    while (currentElement) {
+      if (currentElement.disabled)
+	return true;
+
+      currentElement = currentElement.parentElement;
+    }
+    return false;
   }
 };