Bug 1582533 - remove <observes> usage from mailnews/. r=? draft
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Thu, 19 Sep 2019 22:51:48 +0300
changeset 79025 1dc78af7f0a53a44268745cfb81b572ecf2ab89f
parent 79024 292f45f41c6706e461c14e60b54e796ae39dc0a0
child 79026 4700b67cf5b8061654a505f832a9b05af4bfa60a
push id9340
push usermkmelin@iki.fi
push dateThu, 19 Sep 2019 19:52:55 +0000
treeherdertry-comm-central@c015adf98048 [default view] [failures only]
bugs1582533
Bug 1582533 - remove <observes> usage from mailnews/. r=?
mailnews/extensions/newsblog/content/feed-subscriptions.js
mailnews/extensions/newsblog/content/feed-subscriptions.xul
--- a/mailnews/extensions/newsblog/content/feed-subscriptions.js
+++ b/mailnews/extensions/newsblog/content/feed-subscriptions.js
@@ -1104,17 +1104,19 @@ var FeedSubscriptions = {
         : updates.updateMinutes / (24 * 60);
     updateValue.value = Number(minutes);
     if (isFeed) {
       recommendedUnitsVal.value = this.getUpdateMinutesRec(updates);
     } else {
       recommendedUnitsVal.value = "";
     }
 
-    recommendedUnits.hidden = recommendedUnitsVal.value == "";
+    let hideRec = recommendedUnitsVal.value == "";
+    recommendedUnits.hidden = hideRec;
+    recommendedUnitsVal.hidden = hideRec;
 
     // Autotag items.
     let autotagEnable = document.getElementById("autotagEnable");
     let autotagUsePrefix = document.getElementById("autotagUsePrefix");
     let autotagPrefix = document.getElementById("autotagPrefix");
     let category = aItem.options ? aItem.options.category : null;
 
     autotagEnable.checked = category && category.enabled;
@@ -1464,33 +1466,37 @@ var FeedSubscriptions = {
   setFocus() {
     let item = this.mView.currentItem;
     if (!item || this.mActionMode == this.kImportingOPML) {
       return;
     }
 
     let locationValue = document.getElementById("locationValue");
     let updateEnabled = document.getElementById("updateEnabled");
-    let updateValue = document.getElementById("updateValue");
-    let biffUnits = document.getElementById("biffUnits");
+
     let quickMode = document.getElementById("quickMode");
     let autotagEnable = document.getElementById("autotagEnable");
     let autotagUsePrefix = document.getElementById("autotagUsePrefix");
     let autotagPrefix = document.getElementById("autotagPrefix");
 
     let addFeedButton = document.getElementById("addFeed");
     let updateFeedButton = document.getElementById("updateFeed");
 
     let isServer = item.folder && item.folder.isServer;
     let isFolder = item.folder && !item.folder.isServer;
 
     // Enabled by default.
     updateEnabled.disabled = quickMode.disabled = autotagEnable.disabled = false;
-    updateValue.disabled = !updateEnabled.checked;
-    biffUnits.disabled = !updateEnabled.checked;
+
+    updateEnabled.parentNode
+      .querySelectorAll("input,radio,label")
+      .forEach(item => {
+        item.disabled = !updateEnabled.checked;
+      });
+
     autotagUsePrefix.disabled = !autotagEnable.checked;
     autotagPrefix.disabled =
       autotagUsePrefix.disabled || !autotagUsePrefix.checked;
 
     let focusedElement = window.document.commandDispatcher.focusedElement;
 
     if (isServer) {
       addFeedButton.disabled =
@@ -1500,18 +1506,22 @@ var FeedSubscriptions = {
     } else if (isFolder) {
       let disable =
         !locationValue.hasAttribute("focused") && !locationValue.value;
       // Summary is enabled for a folder with feeds or if adding a feed.
       quickMode.disabled =
         disable && !FeedUtils.getFeedUrlsInFolder(item.folder);
       // All other options disabled unless intent is to add a feed.
       updateEnabled.disabled = disable;
-      updateValue.disabled = disable;
-      biffUnits.disabled = disable;
+      updateEnabled.parentNode
+        .querySelectorAll("input,radio,label")
+        .forEach(item => {
+          item.disabled = disable;
+        });
+
       autotagEnable.disabled = disable;
 
       addFeedButton.disabled =
         addFeedButton != focusedElement &&
         !locationValue.hasAttribute("focused") &&
         !locationValue.value;
     } else {
       // Summary is disabled; applied per folder to apply to all feeds in it.
--- a/mailnews/extensions/newsblog/content/feed-subscriptions.xul
+++ b/mailnews/extensions/newsblog/content/feed-subscriptions.xul
@@ -143,41 +143,34 @@
         <hbox align="center">
           <checkbox id="updateEnabled"
                     label="&biffStart.label;"
                     accesskey="&biffStart.accesskey;"
                     oncommand="FeedSubscriptions.setPrefs(this);"/>
           <html:input id="updateValue" type="number" class="size3" min="1"
                       aria-labelledby="updateEnabled updateValue biffMinutes biffDays recommendedUnits recommendedUnitsVal"
                       oninput="FeedSubscriptions.setPrefs(this);"
-                      onchange="FeedSubscriptions.setPrefs(this);">
-              <observes element="updateEnabled" attribute="disabled"/>
-          </html:input>
+                      onchange="FeedSubscriptions.setPrefs(this);"/>
           <radiogroup id="biffUnits"
                       orient="horizontal"
                       oncommand="FeedSubscriptions.setPrefs(this);">
             <radio id="biffMinutes" value="min" label="&biffMinutes.label;"
                    accesskey="&biffMinutes.accesskey;"/>
             <radio id="biffDays" value="d" label="&biffDays.label;"
                    accesskey="&biffDays.accesskey;"/>
           </radiogroup>
           <hbox id="recommendedBox">
             <label id="recommendedUnits"
                    value="&recommendedUnits.label;"
                    hidden="true"
-                   control="updateMinutes">
-              <observes element="updateValue" attribute="disabled"/>
-            </label>
+                   control="updateMinutes"/>
             <label id="recommendedUnitsVal"
                    value=""
                    hidden="true"
-                   control="updateMinutes">
-              <observes element="updateValue" attribute="disabled"/>
-              <observes element="recommendedUnits" attribute="hidden"/>
-            </label>
+                   control="updateMinutes"/>
           </hbox>
         </hbox>
         <checkbox id="quickMode"
                   accesskey="&quickMode.accesskey;"
                   label="&quickMode.label;"
                   oncommand="FeedSubscriptions.setSummary(this.checked);"/>
         <checkbox id="autotagEnable"
                   accesskey="&autotagEnable.accesskey;"