Michael Schuerig
2005-May-27 01:55 UTC
tag, content_tag: are nil-valued options ever useful?
In a number of places in my code I pass options whose value are '''' or nil to one of the tag-generation helper methods. In the HTML this shows up as, e.g. <span class=""> Now, this can be pretty wasteful, but I don''t want to change my evil ways. Thus I''d rather have the framework throw out these options than do it myself. AFAICT, all tag generation is funnelled through ActionView::Helpers::TagHelper#tag_options where nil-valued options could easily be filtered. There are two question I''m not clear about, though: * Is there ever a use for an empty attribute? * Can it be useful to differentiate between nil and empty as the value of an option? Michael -- Michael Schuerig Thinking is trying to make up mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org for a gap in one''s education. http://www.schuerig.de/michael/ --Gilbert Ryle