[Zope] image inclusion: empty ALT not the same as no ALT

Tino Wildenhain tino@wildenhain.de
Fri, 23 Jun 2000 16:10:56 +0200


Hi J,

J M Cerqueira Esteves wrote:
> 
> Greetings
> 
> I just noticed a problem with the `tag' method:
> 
> If I insert an image with
> 
>   <dtml-var "some_image.tag (border='0', alt='')">
> 
> (nice because `width' and `height' are inserted automatically), I get an
> <img> element with NO `alt' attribute, instead of an `alt' atribute with
> an empty string as its value (alt="").
> 
> An empty `alt' value is important when using images for which it is best
> not to insert any alternative text in text browsers (decoration-only or
> redundant image links, for instance), because the absence of the `alt'
> attribute may not be equivalent to an empty value.  In lynx, for example,
> the file name of the image (more precisely, the last component of the
> path in the `src' attribute) is shown (yuck) when no `alt' attribute is
> supplied.
I assume the check for the attribute is only something like that:

if alt: 
...

So an empty string is considered also false.

You can work around with 
<dtml-var "some_image.tag(border='0',alt=' ')">

Since a space is not seen but also not false.

HTH
Tino Wildenhain