Skip to content

Rhaptos Software Development

Personal tools
You are here: Home » Developer Blog » Jenn's DevBlog » Plone's table code is naughty!

Plone's table code is naughty! Plone's table code is naughty!

Document Actions
Submitted by jenn. on 2005-06-14 17:01. Development
I spent most of this afternoon tracking down why a certain type of link didn't seem to be accessible by Selenium.
Long story short, Plone uses the following HTML construction in its default table layout:

        <a href="blah"><img src="foo" />&nbsp;LinkText</a>

...and that's not valid XHTML.

Personally, I would never generate HTML like that to begin with. It causes the space between the image and the text to be underlined as part of the link, and that's unsightly. The Right Way™ to do that is as follows:

        <a href="blah"><img src="foo" /></a>&nbsp;<a href="blah">LinkText</a>

I have occasionally been scoffed at for caring about minutae like that, but here I am vindicated! There are more reasons than aesthetics to avoid the offending construction: for example, it makes XPath parsers choke. And when you're relying on XPath to address page elements for automated testing...grr!

The amusing thing is that someone out there in Ploneland evidently agrees with me. This cryptic comment appears above the table code in question:

       <!-- Careful with that markup, Eugene ;)
              nbsp sucks, but blame the browsers.
              ~limi -->

Not sure how to go about solving the problem. I suspect that table-generating code is pretty deep down inside Plone, and isn't easily amenable to customization. But I could be wrong! If I am, here's the patch. ;)

--- folder_contents.pt  2005-06-14 17:07:05.000000000 -0500
+++ /opt/zope/bugday/Products/CMFPlone/skins/plone_templates/folder_contents.pt 2004-12-01 08:54:26.000000000 -0600
@@ -199,10 +199,8 @@
 
                                              alt item_typeinfo/Title;
                                              title item_typeinfo/Title;"
-                             i18n:attributes="title"/>
-                      </a>&nbsp;
-                      <a href="#" tal:attributes="href url; title item/Description;">
-                        <strong tal:omit-tag="python:not isBrowserDefault"><span tal:replace="item/title_or_id">Title</span></strong>
+                             i18n:attributes="title"
+                             />&nbsp;<strong tal:omit-tag="python:not isBrowserDefault"><span tal:replace="item/title_or_id">Title</span></strong>
                       </a>
 
                       <a href="absolute_url/external_edit"

Re: Plone's table code is naughty!

Posted by jccooper at 2005-06-16 19:23
Wow, the rendering of <code> in here is pretty unreadable.

Anyway, that's an easy fix to make. I'll check it in if it isn't already there.

Re: Re: Plone's table code is naughty!

Posted by jccooper at 2005-06-16 19:38
Well, I tried to fix it, but both my Plone instance and CVS are broken for me at the moment.

You can find the modified files for checking on sullivan:~jccooper/software/zope/CNXPloneSite/skins/cnx_overrides/folder_contents.pt*

Re: Re: Plone's table code is naughty!

Posted by jenn at 2005-06-28 11:58
Actually, I made that deliberately small, figuring that most people wouldn't want the details, and if they did, they'd be copying and pasting it somewhere else anyway.
Developer Blog
« July 2008 »
Su Mo Tu We Th Fr Sa
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
2008-07-02
12:53-12:53 Performance tests of module PDF generation
Categories:
Content (55)
Copyright (0)
Deep Code (3)
Development (198)
Markup (22)
Metadata (1)
Printing (7)
Style (9)
Testing (2)
Usability (6)