Closed Bug 135838 Opened 22 years ago Closed 21 years ago

Restoring FORM components background style information not working

Categories

(Core :: DOM: CSS Object Model, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: ryan.gustafson, Unassigned)

References

Details

Attachments

(1 file)

Assume you have an INPUT element on a FORM.  You read the current
style.background property on the form, and save it.  You set the
style.background to something new.   Then you reset it to the original value. 
In such cases the _original_ value is not being restored.

In my case, the original value seems to be blank, so it could just be a boundary
case.

I've only tested this with Mozilla 0.9.9 on Windows 2000 and IE6.  It works in IE6.

Here's a test HTML page that demonstrates the problem.  Just press the button 3
times.  The 3rd press is supposed to restore the textbox, but it doesn't.

-----------------------
<html>
<head>
<script>
var origColor;
var origBg;
var toggle = true;
function doBug()
{  
   var component = document.forms[0].textbox;
   var newColor;
   var newBg;

   // Backup original value, set to new value
   if (toggle)
   {
      origColor = component.style.color;
      origBg = component.style.background;
      newColor = "#FF0000";
      newBg = "#FFCCCC";
   }
   // Restore original value.
   else
   {
      newColor = origColor;
      newBg = origBg;
   }

   alert("Current color: <" + component.style.color + ">\nSetting to: <" +
newColor + ">"
         + "\n\nCurrent background: <" + component.style.background +
">\nSetting to: <" + newBg + ">");


   component.style.color = newColor;
   component.style.background = newBg;
   toggle = ! toggle;
}
</script>
</head>
<body>
  <form>
     Textbox <input type="text" size="30" name="textbox" value="Just some
meaningless text">
     <p>
     <input type="submit" value="Test Bug" onClick="doBug(); return false">
  </form>
</body>
</html>
Browser, not engine. Reassigning to DOM Style; cc'ing jkeiser, Boris.
This may be a dupe...

Confirming reported behavior currnent Mozilla trunk binaries on Linux, WinNT.
OS: Win ---> All.

Try the testcase in IE6: the background color toggles successfully.
Try it in Mozilla: background color changes to pink, then remains pink...
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → DOM Style
Ever confirmed: true
OS: Windows 2000 → All
QA Contact: pschwartau → ian
ccing glazou; this sounds like his sort of thing.  Should our shorthand 
handling actually generate a useful value for foo.style.background in the state 
it's in right now?
Depends on: 52531
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
This was fixed by the checkin for bug 125246
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: