Closed Bug 1044174 Opened 11 years ago Closed 11 years ago

Pages with HTML5 doctype do not render images without a source correctly

Categories

(Core :: Layout, defect)

31 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: ryan.benson, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0 (Beta/Release) Build ID: 20140716183446 Steps to reproduce: Use the sample code: <!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <img alt="my alt" aria-labelledby="t1" width="200" height="100"> <p>random text</p> <p id="t1">descriptive text</p> </body> </html> Actual results: The alt gets rendered as what looks to be normal text. If you remove the doctype declaration, the image's width and height is rendered. Expected results: The unknown image icon with the image's width and height should be rendered if you declare a doctype.
Component: Untriaged → General
Component: General → Layout
Product: Firefox → Core
> The alt gets rendered as what looks to be normal text. Yes, this is the behavior the HTML spec calls for. The reason for that is that the alt text is meant to be read, and if you restrict it to the sized image box it's typically cut off so can't be read, which totally defeats the purpose. The relevant spec section is http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#images-2 where it says: If the element is an img element that represents some text and the user agent does not expect this to change The user agent is expected to treat the element as a non-replaced phrasing element whose content is the text, optionally with an icon indicating that an image is missing, so that the user can request the image be displayed or investigate why it is not rendering. In non-graphical contexts, such an icon should be omitted. "non-replaced phrasing element" is defined as http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#phrasing-content -- think things like <span>. "represents" is defined in the section at http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content.html#the-img-element where it says: What an img element represents depends on the src attribute and the alt attribute. If the src attribute is set ... Stuff that does not apply here If the src attribute is not set and either the alt attribute is set to the empty string or the alt attribute is not set at all The element represents nothing. Otherwise The element represents the text given by the alt attribute. So in this case the <img> represents some text.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.