[Patch] a renderer for <FIELDSET> and <LEGEND>

Lars Knoll lars at trolltech.com
Thu Jul 25 07:57:34 BST 2002


> Le Mercredi 24 Juillet 2002 10:26, Lars Knoll a écrit :
> > I don't really like the fact, that legend get's a rendering element. I
> > think it should get "display: none" in the default stylesheet. We should
>
> Ah, I new you would say that ! :) It hurted me as well ! :)
> In fact it was my first approach, but it is not quite satisfactory, and I
> now think it's wrong ...
> Sure, this is quite a special case since the HTML DTD doesn't define LEGEND
> as either %inline or %block...
> But OTOH, it defines it as :
> <!ELEMENT LEGEND - - (%inline;)*       -- fieldset legend -->
>
> and NOT :
> <!ELEMENT LEGEND - - (#PCDATA)       -- fieldset legend -->
>
> Which means, if you follow strictly the spec, that Legend must accept funny
> things such as <IMG>s, <INPUT>s, anchors and other fontstyling element, but
> should not actually render them because the container is not %flow !?!
> That sucks beyond belief !

Ok. You;re right. But that means that we should treat the first legend as the 
one to render the "legend" of the fieldset, and all others (they should not 
exist, but we all know how web pages look...) as regular flows.

> People do style their legends, do put imgs in their legends, because they
> are allowed to do so...

Ok. Then I see your point, and basically agree with your patch.

> Now, I don't know how IE render them, because I have no IE here and that's
> not my reference (my reference is KHTML :), but yes Mozilla style them,
> Opera style them ... so what ?
>
> > then search for a legend element in the DOM tree, not the rendering tree,
>
> I do ensure that legend is unique inside it's HTMLFieldsetElementImpl, but
> you could only extract #PCDATAs from here, as innerText() do... that's not
> following the DTD either... why would they be more important than e.g. an
> image ?

Please apply your patch then :)

Cheers,
Lars





More information about the kfm-devel mailing list