From 62a35a4ad67d2d7ccdf8077e4ab6a0231695b6ab Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Fri, 7 Oct 2005 19:19:44 +0000 Subject: [PATCH] Bug 309041 Changing the proportional font does not update the default font until options are re-opened patch by Dave Townsend r=mano --- toolkit/content/widgets/preferences.xml | 45 ++++++++++++++++++++----- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/toolkit/content/widgets/preferences.xml b/toolkit/content/widgets/preferences.xml index b90b9ee746b..d03693c9d7e 100644 --- a/toolkit/content/widgets/preferences.xml +++ b/toolkit/content/widgets/preferences.xml @@ -90,9 +90,20 @@ if (document.documentElement.type == "child" && !this.instantApply && window.opener) { var pdoc = window.opener.document; - var lastStatePref = pdoc.getElementById(window.location.href + "#" + this.id); - this._setValue(lastStatePref ? lastStatePref.value - : this.valueFromPreferences, false); + + // Try to find a preference element for the same preference. + var preference = null; + var parentPreferences = pdoc.getElementsByTagName("preferences"); + for (var k = 0; (k < parentPreferences.length && !preference); ++k) { + var parentPrefs = parentPreferences[k] + .getElementsByAttribute("name", this.name); + for (var l = 0; (l < parentPrefs.length && !preference); ++l) { + if (parentPrefs[l].localName == "preference") + preference = parentPrefs[l]; + } + } + this._setValue(preference ? preference.value + : this.valueFromPreferences, false); } else this._setValue(this.valueFromPreferences, false); @@ -170,6 +181,9 @@ else this.removeAttribute("disabled"); + if (!this.id) + return val; + var elements = document.getElementsByAttribute("preference", this.id); for (var i = 0; i < elements.length; ++i) { elements[i].disabled = val; @@ -195,6 +209,9 @@ else this.removeAttribute("tabindex"); + if (!this.id) + return val; + var elements = document.getElementsByAttribute("preference", this.id); for (var i = 0; i < elements.length; ++i) { elements[i].tabIndex = val; @@ -450,6 +467,9 @@