[Html-widget] opinions of removing implicit fieldset / breaking back-compat

Andreas Marienborg omega at palle.net
Wed Nov 8 14:05:16 GMT 2006


I think the idea of moving away from autocreating the container is  
probably a good idea.

What I would like it to do is to refuse to add non-block elements  
directly to the form tag, so you ensure that they create the block  
themselves. That would also make it easier to find the places with  
missing containers as they would create deaths in tests.

supporting HTML4 should perhaps then be another method on $result in  
addition to ->as_xml, perhaps as_html_anno_1999 or somesuch :p

andreas

On 8. nov. 2006, at 14.57, Carl Franks wrote:

> On 08/11/06, Andreas Marienborg <omega at palle.net> wrote:
>> HTML::Widget really should produce valid XML/XHTML, as the method is
>> named as_xml
>
> While I don't disagree, my question was whether it's acceptable to
> force users to take an extra step to ensure that.
>
> I can see a possible alternative...
>
> The original behaviour was: you add elements to a widget, this  
> produced...
> <form>
>  <fieldset>
>    <input>
>    <input>
>  </fieldset>
> </form>
> The fieldset could be set to a different tag type, using
> $w->subcontainer( 'p' ) to create a paragraph, for example.
>
> To support new Fieldset and Block elements, we made the decision that
> if a Block/Fieldset was the first element added to the widget, the
> implicit fieldset wasn't added because you were going to add the
> elements to the block you created yourself, and you might want to nest
> fieldsets while you were at it.
>
> Instead, we could go back to always adding the implicit fieldset,
> regardless of what type of element is added to the widget first.
> The effect of this will be - for people adding an explicit fieldset,
> then adding elements to that fieldset - there would be an extra
> fieldset created.
>
> $fs = $w->element( 'Fieldset' );
> $fs->element( Textfield => 'foo' );
> #
> <form>
>  <fieldset>
>    <fieldset>
>      <input>
>    </fieldset>
>  </fieldset>
> </form>
> It would probably be trivial to fix this by adding an option for
> $w->no_subcontainer(1)
> to get rid of the implicit subcontainer.
> This would leave much less mess in the internals than the current
> checks for 'implicit_subcontainer' do.
>
> Is this a better compromise?
> It will have no effect on code written before the Block/Fieldset were
> introduced in August, and the fix required - a new method call - is
> much simpler than my previously suggested change of adding all
> elements to a fieldset instead of the widget.
>
> The no_subcontainer() could also be used for people proud to be using
> HTML4, Ash ;P
>
> Carl
>
> _______________________________________________
> Html-widget mailing list
> Html-widget at lists.rawmode.org
> http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget




More information about the Html-widget mailing list