Closed
Bug 70820
Opened 24 years ago
Closed 19 years ago
ALT in broken image cannot be changed by the DOM
Categories
(Core :: Layout: Images, Video, and HTML Frames, defect, P4)
Core
Layout: Images, Video, and HTML Frames
Tracking
()
RESOLVED
FIXED
Future
People
(Reporter: ronbu, Assigned: jst)
References
()
Details
(Keywords: testcase, Whiteboard: [Hixie-P2])
Attachments
(3 files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
dbaron
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
(deleted),
text/html
|
Details |
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; 0.9) Gecko/20010302
BuildID: 2001030205
When I click the Change button the ALT fails to change to the
message I placed in the text field. Here is the function that is
supposed to change the ALT.
function alt1(){document.IMG1.alt = document.FORM.form.value}
Here is the image.
<img SRC="im.gif" name="IMG1" WIDTH="300" HEIGHT="100" ALT="YouCanChangeThisText">
Here is the Change button.
<input TYPE="button" VALUE="Change" onClick="alt1()">
Reproducible: Always
Steps to Reproduce:
1.Point Mozilla to
http://www.bekkoame.ne.jp/~hamba/mozilla/HTMLImageElement/alt.html
2. Click the change button.
Actual Results: The ALT remains the same.
Expected Results: The ALT should change to the text in the text field.
This DOM script works fine on IE 5.5 .
Comment 1•24 years ago
|
||
First, document.IMG1.alt = foo isn't valid. You need to either use
document.getElementByID or document.getElementsByName. That said, after changing
the above example it still doesn't work so I'm confirming this with
user agent: Mozilla/5.0 (Windows; U; Win98; en-US; 0.9) Gecko/20010302
build: 2001030205
I have a feeling this is another symptom of the problem talked about in bug 22820.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 2•24 years ago
|
||
Assignee | ||
Comment 4•24 years ago
|
||
Future for now.
OS: Windows 98 → All
Hardware: PC → All
Target Milestone: --- → Future
Updated•24 years ago
|
Whiteboard: [Hixie-P2]
Comment 6•23 years ago
|
||
{
var altVal = document.getElementById("text").value;
document.getElementById("image").alt = altVal;
alert(document.getElementById("image").alt);
}
alerts the new value but does not show on the image
Updated•23 years ago
|
Keywords: mozilla1.0
Comment 7•23 years ago
|
||
This does not look like a DOM problem. Layout is being provided the
attributechanged notification. It just does not do anything with it.
Switching to another window and then back will show the new (changed) text.
Layout simply needs to repaint when the alt text changes.
Attaching patch in a minute.
Comment 8•23 years ago
|
||
Simply forces reflow when the alt attribute changes.
This makes the correct thing happen with the test case above, and does not do
anything funny when the image actually loaded correctly. But I'm still
wondering if we should check if the image failed to load before doing this.
Assignee | ||
Comment 9•23 years ago
|
||
Comment on attachment 73851 [details] [diff] [review]
one-liner that seems to fix the problem
From what I can tell, this does the right thing, and I'm willing to sr it.
Someone who understands layout better should have a look at this one-liner and
review though. attinasi, dbaron?
Attachment #73851 -
Flags: superreview+
Assignee | ||
Comment 10•23 years ago
|
||
Comment on attachment 73851 [details] [diff] [review]
one-liner that seems to fix the problem
From what I can tell, this does the right thing, and I'm willing to sr it.
Someone who understands layout better should have a look at this one-liner and
review though. attinasi, dbaron?
sr=jst
Assignee | ||
Comment 11•23 years ago
|
||
Errr, I hate it when that happens...
Comment 13•23 years ago
|
||
attinasi, could you please take a look at the one-liner that seems to fix this
bug? thanks in advance :-)
Comment 14•22 years ago
|
||
Just a reminder that this one liner is *still* waiting for a review.
Does anyone have any suggestions about who in order to get someone to look at this?
Component: DOM Other → Image: Layout
Comment 15•22 years ago
|
||
Comment on attachment 73851 [details] [diff] [review]
one-liner that seems to fix the problem
I am inclined to say that we should check that the image request failed here.
It won't cause anything bad to happen because it will just reflow things that
don't need it, but that is unnecessary. Harshal, if you want a review, you
need to send email to people directly instead of asking in bugs....
Comment 16•22 years ago
|
||
Comment on attachment 73851 [details] [diff] [review]
one-liner that seems to fix the problem
I'm surprised that only a reflow fixes it (and no changes to the frame tree are
required). Since testing shows that seems to be the case, r=dbaron. I'm not
worried about the performance if the image exists because this seems rare
enough that there's no need to optimize.
Attachment #73851 -
Flags: review+
Comment 17•22 years ago
|
||
well, I stumbled over this rather old patch today... I checked it in, hope
that's ok with you all (after I verified that the bug still occurs and that the
patch fixes it). I had to apply the patch by hand because it didn't apply.
Checking in mozilla/layout/html/base/src/nsImageFrame.cpp;
/cvsroot/mozilla/layout/html/base/src/nsImageFrame.cpp,v <-- nsImageFrame.cpp
new revision: 1.274; previous revision: 1.273
done
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 18•22 years ago
|
||
Sorry, this is not fixed quite yet. It's fixed in quirks mode. It's not fixed
in standards mode; as dbaron was guessing, changes to alt text in standards mode
require a reframe if the image is not showing.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 19•22 years ago
|
||
Comment 20•21 years ago
|
||
One way to fix this would be to use:
img:-moz-broken-img::before { content: attr(alt) }
once we support the -moz-broken-img pseudo-class...
Comment 21•19 years ago
|
||
Fixed in standards mode by bug 11011
Status: REOPENED → RESOLVED
Closed: 22 years ago → 19 years ago
Depends on: moz-broken
Resolution: --- → FIXED
Updated•6 years ago
|
Product: Core → Core Graveyard
Updated•6 years ago
|
Product: Core Graveyard → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•