Closed
Bug 64394
Opened 24 years ago
Closed 24 years ago
image not redrawn when changing 'src' property in JS 'onclick' event
Categories
(Core :: Layout, defect)
Tracking
()
VERIFIED
WORKSFORME
mozilla0.8.1
People
(Reporter: dherndl, Assigned: karnaze)
Details
PROBLEM:
an image doesn't get redrawn when changing
Image.src property dynamically in JavaScript after
loading the page.
see testcase below.
when i added a dummy 'alert' call in the JavaScript
function 'toggle', the image was correctly redrawn.
OTHER WORKAROUND:
change line of testcase
<a href="javascript:void(0)" onclick="toggle()">
to
<a href="javascript:toggle()">
VERSIONS USED:
. Mozilla 0.6
. Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; m18) Gecko/20010104
TESTCASE:
8<-----8<-----8<-----
<html>
<head>
<script type="text/javascript">
var state = 0;
var images = ["red.jpg", "green.jpg", "yellow.jpg"];
function toggle()
{
document.pic.src = images[++state % images.length];
document.frm.inp.value = document.pic.src;
}
</script>
</head>
<body>
<img name="pic" src="red.jpg" border="1">
<a href="javascript:void(0)" onclick="toggle()">Toggle</a>
<form name="frm"><input name="inp" size="80"></form>
</body>
</html>
8<-----8<-----8<-----
Comment 1•24 years ago
|
||
Reporter try downloading one of the latest builds from
http://www.mozillazine.org/build_comments/ and seeing if it still happens in
that version.
I've now tried mozilla-win32.zip from
http://ftp.mozilla.org/pub/mozilla/nightly/2001-01-05-06-Mtrunk
The redraw problem is still there.
I built a mozilla debug version using mozilla-source.tar.gz from
http://ftp.mozilla.org/pub/mozilla/nightly/2001-01-05-08-Mtrunk
After debugging I found these two scenarios:
1) image not redrawn
clicking this link from the testcase HTML
<a href="javascript:void(0)" onclick="toggle()">Toggle</a>
produced this line on the debug console and did not
correctly redraw the image:
Error loading URL javascript:void(0): 805303f5
2) image redrawn
Now I modified the link to this:
<a href="javascript:toggle()">Toggle</a>
Clicking the link displayed this line on the debug console and
updated the image as expected:
Document javascript:toggle() loaded successfully
It looks like if the document get's only re-rendered after
using a link with "javascript:" href, if the DOM-modifing
JavaScript code is triggered by href and not by an event handler
(onclick, ...).
Comment 5•24 years ago
|
||
I disagree with:
>It looks like if the document get's only re-rendered after
>using a link with "javascript:" href
I can reproduce when href has a value of a website and the onclick does not
return false. So it fails when you have an onclick that modifies the image and
then the href loads a page. Try the URL I made it for a test case
http://troxell.com/development/debug/Mozilla_bug_proof.html
Comment 6•24 years ago
|
||
Reassigning QA Contact for all open and unverified bugs previously under Lorca's
care to Gerardo as per phone conversation this morning.
QA Contact: lorca → gerardok
changing the component to 'Layout'.
Assignee: clayton → karnaze
Component: HTML Element → Layout
QA Contact: bsharma → petersen
Target Milestone: --- → mozilla0.8.1
Assignee | ||
Comment 9•24 years ago
|
||
I'm not seeing the problem on WinNT on
http://troxell.com/development/debug/Mozilla_bug_proof.html. Marking worksforme.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•