diff --git a/mozilla/toolkit/content/widgets/checkbox.xml b/mozilla/toolkit/content/widgets/checkbox.xml index 5fc27c12d72..3133564ca42 100644 --- a/mozilla/toolkit/content/widgets/checkbox.xml +++ b/mozilla/toolkit/content/widgets/checkbox.xml @@ -35,9 +35,9 @@ - - - - // Sync the checked value from the "value" attribute if necessary. - this.checked = this.value; - diff --git a/mozilla/toolkit/content/widgets/colorpicker.xml b/mozilla/toolkit/content/widgets/colorpicker.xml index 551c4eedf1c..7a9451457cc 100644 --- a/mozilla/toolkit/content/widgets/colorpicker.xml +++ b/mozilla/toolkit/content/widgets/colorpicker.xml @@ -451,7 +451,6 @@ - @@ -363,7 +379,24 @@ dump(e); } } - var value = ("value" in aElement) ? aElement.value : aElement.getAttribute("value"); + + /** + * Read the value of an attribute from an element, assuming the + * attribute is a property on the element's node API. If the property + * is not present in the API, then assume its value is contained in + * an attribute, as is the case before a binding has been attached. + */ + function getValue(element, attribute) { + if (attribute in element) + return element[attribute]; + return element.getAttribute(attribute); + } + if (aElement.localName == "checkbox") + var value = getValue(aElement, "checked"); + else if (aElement.localName == "colorpicker") + value = getValue(aElement, "color"); + else + value = getValue(aElement, "value"); switch (this.type) { case "int":