Plone's table code is naughty!
Submitted by
jenn.
on 2005-06-14 17:01.
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" /> 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> <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>
-
<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"
+
/> <strong tal:omit-tag="python:not
isBrowserDefault"><span
tal:replace="item/title_or_id">Title</span></strong>
</a>
<a href="absolute_url/external_edit"

Anyway, that's an easy fix to make. I'll check it in if it isn't already there.
You can find the modified files for checking on sullivan:~jccooper/software/zope/CNXPloneSite/skins/cnx_overrides/folder_contents.pt*