g2filter generates non-valid HTML

iweb - September 8, 2009 - 13:41
Project:Gallery
Version:HEAD
Component:Filter / G2Image
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

When using the g2filter, a macro such as [G2: 29] is replaced by html code that looks something like:

<div class ="giImageBlock nowrap"><div class="block-imageblock-ImageBlock nowrap">
<div class="one-image">
<img src="/gallery2/d/31-2/pic.jpg?g2_GALLERYSID=7957dc06a04d5fb4dd1de069dcede846" width="150" height="41" id="IFid1" class="ImageFrame_none" alt="Some Image"/>
<h4 class="giDescription">
Some Image
</h4>
</div>
</div>
</div>

Unfortunately, these pieces of generated code end up inside paragraphs, so we end up with

<p> Some text .....
<div class ="giImageBlock nowrap"><div class="block-imageblock-ImageBlock nowrap">
<div class="one-image">
<img src="/gallery2/d/31-2/pic.jpg?g2_GALLERYSID=7957dc06a04d5fb4dd1de069dcede846" width="150" height="41" id="IFid1" class="ImageFrame_none" alt="Some Image"/>
<h4 class="giDescription">
Some Image
</h4>
</div>
</div>
</div>
</p>

which is invalid - divs are the top level block element and shouldn't be embedded in paragraphs. I'd suggest that until HTML5 comes along, we should be used spans instead of divs and using CSS to set them to 'display: block', and tidying the code so we end up with something like

<span class="g2Image">
<img src="..." alt="..." />
<span class="g2ImageDetail">Image info</span>
</span>

 
 

Drupal is a registered trademark of Dries Buytaert.