Tidy gives warning: "trimming empty <span>" with Fivestar

Balrog - June 23, 2009 - 17:17
Project:Fivestar
Version:6.x-1.15
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:active
Description

When I use the line

<?php
print $node->content['fivestar_widget']['#value']
?>
or
<?php
 
print $comment->fivestar_view
?>
(with the comments module) in my template, the following (or similar) HTML is generated:

4.666665

This causes the HTML to not validate because of the empty "Warning: trimming empty ."

#1

Balrog - June 23, 2009 - 19:07

Looks like it got dropped ...

<div class="fivestar-widget-static fivestar-widget-static-vote fivestar-widget-static-5 clear-block"><div class="star star-1 star-odd star-first"><span class="on">4</span></div><div class="star star-2 star-even"><span class="on"></span></div><div class="star star-3 star-odd"><span class="on"></span></div><div class="star star-4 star-even"><span class="on"></span></div><div class="star star-5 star-odd star-last"><span class="off"></span></div></div>

#2

quicksketch - June 30, 2009 - 23:08
Title:HTML generated by fivestar-static is not valid HTML, "trimming empty <span>"» Tidy gives warning: "trimming empty <span>" with Fivestar
Priority:normal» minor

Empty tags are valid XHTML, that's actually just a message generated by Tidy when it parses the page (assuming that's what you're using to do the validation). If you run the HTML against http://validator.w3.org/, you'll see that it validates just fine. However it would still be nice to get rid of that warning, even if it's only generated by Tidy.

#3

Balrog - July 3, 2009 - 23:06

Yes, I was using Tidy. I use the serial validator in the Firefox extension.

#4

phoehne - July 6, 2009 - 10:23

you could overwrite the theme function 'theme_fivestar_static' an simply add an else tree to this if condition:
if ($n == 1)$output .= $numeric_rating; (zeile 1417)

there you put an html comment and your warnings are gone

peter

#5

giorgio79 - July 20, 2009 - 06:08

Just noticed this as well, I prefer a clean html also :)

Peter can you put your suggestion in tags to be clear where to comment out stuff?

 
 

Drupal is a registered trademark of Dries Buytaert.