This project is archived and is in readonly mode.

#1565 ✓wontfix
Nathan de Vries

[PATCH] Allow disabling of self-closing tags generation TagHelper#tag

Reported by Nathan de Vries | December 12th, 2008 @ 06:42 AM | in 2.x

Helpers like stylesheet_link_tag cannot be used when using a DOCTYPE of HTML 4.01 Transitional (e.g. if you're using iFrame remoting). This patch provides a way to globally turn off self-closing tags:

ActionView::Helpers::TagHelper.generate_self_closing_tags = false

And also allows the option to be set on a case-by-case basis:

stylesheet_link_tag :screen, :open => true

Comments and changes to this ticket

  • Frederick Cheung

    Frederick Cheung December 12th, 2008 @ 07:38 AM

    I'm not going to comment on the usefullness of such a patch, but at the very least it needs tests.

  • Andrew White

    Andrew White December 13th, 2008 @ 03:48 AM

    Save yourself sometime and read this thread:

    Then go and do something more productive with your time.

    If you still really want HTML4 output from rails then you'll need to write a plugin which patches tag and also the handful of places in Rails that hardcode self closing tags, e.g: simple_format.

  • Nathan de Vries

    Nathan de Vries December 14th, 2008 @ 04:16 AM

    @Andrew White: How infuriating. Thanks for pointing me to your ticket and saving me some time. Kind of disappointing to see people referring to HTML 4.01 as "retarded", and being backed up by Rails-core guys. It's the equivalent of arguing that "foo unless bar" is somehow wrong because it's not enclosed in an "unless"/"end" statement.

    I could have sworn the majority of the web development community had realised their overzealousness when it came to XHTML. Pity that's not the case.

  • Frederick Cheung

    Frederick Cheung December 14th, 2008 @ 10:32 AM

    • State changed from “new” to “wontfix”

    Seems like this is one to leave for now.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket