Changing image by document.images[#].src does not update other values of image-object

VERIFIED WORKSFORME

Status

()

VERIFIED WORKSFORME
17 years ago
15 years ago

People

(Reporter: bugzilla, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1a+) Gecko/20020715
BuildID:    2002071508

When you change an image by document.images[#].src, the new image is loaded but
all other values of the object still remain the oled ones.

E.g., you originally have <IMAGE SRC="MyImage.gif"> (dimensions 10 x 10). You
change the image by "document.images[0].src = mynewimage;" (new dimensions 20 x 20).

Even after the new image was completly loaded, width & height are still 10 x 10.

IMHO width & height should be set to the dimension of the new image. (Exactly
like <IMG SRC=..:> does.) Otherwise you will loose the aspect of the image and
can not really control it by JavaScript.


Reproducible: Always
OS: Windows 2000 → All
Hardware: PC → All
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Is this still a problem with a recent build (March 22 or later nightly)

Comment 3

15 years ago
Created attachment 135598 [details]
Testcase for bug 158596

The problem is that the DOM has no idea of the properties of the image before
it's actually displayed (img to content, anyone? :-)
Testcase attached, it demonstrates that the dimensions are correct after the
image has loaded. Not sure if it's a bug or not.
> The problem is that the DOM has no idea of the properties of the image before
> it's actually displayed (img to content, anyone? :-)

Except I moved images into content about 6 months ago, Fabian.. ;)

This bug as originally reported worksforme; the testcase just shows that the
"Before it's loaded" access is performed before the new image has even started
to load, hence is actually accessing the old image; if you notice, the "before
its loaded" access gives the "new" numbers when the new image is in the cache.

I'm marking this worksforme, since it all seems to be working correctly.
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → WORKSFORME

Comment 5

15 years ago
Woops you're oh-so-way too fast for me, dude!
My bad :-)
VERIFIED WFM.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.