Bug 1453227 - set 'checked' attribute to 'true' to appease checkbox and listitem-checkbox bindings. r?sfoster draft
authorHector Zhao <bzhao@mozilla.com>
Wed, 18 Apr 2018 11:06:36 +0800
changeset 784094 f2d53caa701676dec8b807b23a3d802cfa8ef919
parent 783966 789e30ff2e3d6e1fcfce1a373c1e5635488d24da
push id106850
push userbmo:bzhao@mozilla.com
push dateWed, 18 Apr 2018 03:08:05 +0000
reviewerssfoster
bugs1453227
milestone61.0a1
Bug 1453227 - set 'checked' attribute to 'true' to appease checkbox and listitem-checkbox bindings. r?sfoster MozReview-Commit-ID: WTYYwFIaBO
toolkit/content/preferencesBindings.js
--- a/toolkit/content/preferencesBindings.js
+++ b/toolkit/content/preferencesBindings.js
@@ -360,18 +360,19 @@ const Preferences = window.Preferences =
       function setValue(element, attribute, value) {
         if (attribute in element) {
           element[attribute] = value;
         } else if (attribute === "checked") {
           // The "checked" attribute can't simply be set to the specified value;
           // it has to be set if the value is true and removed if the value
           // is false in order to be interpreted correctly by the element.
           if (value) {
-            // We can set it to anything; convention is to set it to itself.
-            element.setAttribute(attribute, attribute);
+            // In theory we can set it to anything; however xbl implementations
+            // of `checkbox` and `listitem` only work with "true".
+            element.setAttribute(attribute, "true");
           } else {
             element.removeAttribute(attribute);
           }
         } else {
           element.setAttribute(attribute, value);
         }
       }
       if (aElement.localName == "checkbox" ||