Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 13199
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: bsmith [...] sudleyplace.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: Trivial Problem with end_form
Download (untitled) / with headers
text/plain 1.2k
Running perl 5.6.1 under FreeBSD 4.7-RELEASE-p28 #40, using CGI.pm versions 3.08+, I have encountered what I believe is a trivial problem with end_form. In particular, when validating a web page using the HTML Tidy Validator extension for Firefox (http://users.skynet.be/mgueury/mozilla/), if $self->get_fields is empty, the endform method generates "<div></div></form>" which the validator warns about with "Warning: trimming empty <div>" (did I mention that this is a trivial problem?). If the ending code in endform is changed from return wantarray ? ("<div>",$self->get_fields,"</div>","</form>") : "<div>".$self->get_fields ."</div>\n</form>"; to something like return wantarray ? ((0 == length ($self->get_fields)) ? ("</form>") : ("<div>",$self->get_fields,"</div>","</form>")) : ((0 == length ($self->get_fields)) ? "\n</form>" : "<div>".$self->get_fields ."</div>\n</form>"); or even this (if my Perl is up to snuff) $nl = wantarray ? '' : "\n"; @ef = (0 == length ($self->get_fields)) ? ("$nl</form>") : ("<div>",$self->get_fields,"</div>","$nl</form>"); return wantarray ? @ef : join '', @ef; then the HTML Tidy validator is happy, and this trivial problem disappears.
From: PaulWay
Download (untitled) / with headers
text/plain 196b
[guest - Fri Jun 10 20:12:36 2005]: I second this patch - having these divs in the code causes things to misalign and takes up more space, especially in FireFox. Paul Wayper (paulway@mabula.net)
Download (untitled) / with headers
text/plain 1.5k
I'm just confirming that this bug fix was integrated into 3.12 and this bug report can be considered resolved now. Mark On Fri Jun 10 20:12:36 2005, guest wrote: Show quoted text
> Running perl 5.6.1 under FreeBSD 4.7-RELEASE-p28 #40, using CGI.pm > versions 3.08+, I have encountered what I believe is a trivial > problem with end_form. > > In particular, when validating a web page using the HTML Tidy > Validator extension for Firefox > (http://users.skynet.be/mgueury/mozilla/), if $self->get_fields is > empty, the endform method generates "<div></div></form>" which the > validator warns about with "Warning: trimming empty <div>" (did I > mention that this is a trivial problem?). > > If the ending code in endform is changed from > > return wantarray ? ("<div>",$self->get_fields,"</div>","</form>") : > "<div>".$self->get_fields ."</div>\n</form>"; > > to something like > > return wantarray ? ((0 == length ($self->get_fields)) > ? ("</form>") > : ("<div>",$self->get_fields,"</div>","</form>")) > : ((0 == length ($self->get_fields)) > ? "\n</form>" > : "<div>".$self->get_fields ."</div>\n</form>"); > > or even this (if my Perl is up to snuff) > > $nl = wantarray ? '' : "\n"; > @ef = (0 == length ($self->get_fields)) > ? ("$nl</form>") > : ("<div>",$self->get_fields,"</div>","$nl</form>"); > return wantarray ? @ef : join '', @ef; > > then the HTML Tidy validator is happy, and this trivial problem > disappears.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.