[Zope] IMG attributes in ZPT

Casey Duncan casey@zope.com
Mon, 21 Oct 2002 10:05:26 -0400


Please file a collector issue for this.

The border is there by default because most browsers put a border around images when they are inside an anchor tag. Since most of the time people did not want this, they requested this feature.

A couple of fixes come to mind, like adding a "no_border" argument, or allow "border=''" to mean omit that attribute. Some other thoughts include adding a new "xtag" method that generates XHTML strict or a configuration option that tells Zope to generate strict code.

-Casey

On Mon, 21 Oct 2002 08:21:39 -0500
Troy Farrell <troy@entheossoft.com> wrote:

> It's only harmless if you don't validate your XHTML 
> (http://validator.w3.org/check/) or you aren't trying to convert a site 
> to XHTML.
> 
> HTML 4.01 says the border attribute is deprecated.
> http://www.w3.org/TR/html401/struct/objects.html#adef-border-IMG
> 
> XHTML 1.0 Transitional DTD allows it as well:
> 
> <!ELEMENT img EMPTY>
> <!ATTLIST img
>    %attrs;
>    src         %URI;          #REQUIRED
>    alt         %Text;         #REQUIRED
>    name        NMTOKEN        #IMPLIED
>    longdesc    %URI;          #IMPLIED
>    height      %Length;       #IMPLIED
>    width       %Length;       #IMPLIED
>    usemap      %URI;          #IMPLIED
>    ismap       (ismap)        #IMPLIED
>    align       %ImgAlign;     #IMPLIED
>    border      %Length;       #IMPLIED
>    hspace      %Pixels;       #IMPLIED
>    vspace      %Pixels;       #IMPLIED
>    >
> 
> but the XHTML 1.0 Strict DTD doesn't allow the border attribute:
> 
> <!ELEMENT img EMPTY>
> <!ATTLIST img
>    %attrs;
>    src         %URI;          #REQUIRED
>    alt         %Text;         #REQUIRED
>    longdesc    %URI;          #IMPLIED
>    height      %Length;       #IMPLIED
>    width       %Length;       #IMPLIED
>    usemap      %URI;          #IMPLIED
>    ismap       (ismap)        #IMPLIED
>    >
> 
> 
> Troy
> 
> Felix Ulrich-Oltean wrote:
> > On Fri, Oct 18, 2002 at 04:18:54PM -0400, Jon Whitener wrote:
> > 
> >> I found in the docs about the
> >>
> >>  tag(height=None, width=None, alt=None, scale=0, xscale=0, yscale=0, **args)
> >>
> >> method of an Image object, but I have no idea how to access or
> >>modify that stuff.
> > 
> > 
> > <div tal:replace="structure python:here.menu_icon.tag(class='menu-icon')" />
> > 
> > The tag() method of the image will put in height, width and alt
> > itself, and also includes any arguments you give it as attributes in
> > the IMG tag.
> > 
> > 
> > 
> >>I'm glad the WIDTH and HEIGTH are included automagically, but how can I:
> >> - Leave out the BORDER attribute?  I don't know how that got in there.
> > 
> > 
> > You can't with image_object.tag(), but border=0 is a fairly harmless
> > default, isn't it?
> > 
> > Felix.
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )