[ZPT] Re: [Zope] Using ZPT with options/radio/checkboxes

Fred L. Drake, Jr. fred at zope.com
Mon Aug 11 12:00:56 EDT 2003


Chris Withers writes:
 > Is there any chance the list of attributes that behave differently in 
 > HTML could be made definitive rather than saying "Certain boolean 
 > attributes, such as checked and selected,"?

Isn't the HTML specification good enough for this?

 > What is the complete list of attributes that are treated as boolean?

>From zope.tal.talinterpreter:

BOOLEAN_HTML_ATTRS = [
    # List of Boolean attributes in HTML that should be rendered in
    # minimized form (e.g. <img ismap> rather than <img ismap="">)
    # From http://www.w3.org/TR/xhtml1/#guidelines (C.10)
    # XXX The problem with this is that this is not valid XML and
    # can't be parsed back!
    "compact", "nowrap", "ismap", "declare", "noshade", "checked",
    "disabled", "readonly", "multiple", "selected", "noresize",
    "defer"
]

 > Does it matter which tag they're defined on?

No.  Note that this is only taken into consideration in HTML mode,
though; when using XML mode, the munging would not produce well-formed
XML.

 > (eg: will:
 > 
 > <flub tal:attributes="checked python:0"/>
 > 
 > render to:
 > 
 > <flub/>

In HTML mode, yes.

 > or:
 > 
 > <flub checked="0"/>

In XML mode, yes.


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation



More information about the ZPT mailing list