[Bug 12834] LEGEND should be allowed to NOT be exactly first child of FIELDSET ("The legend element" spec section)

https://www.w3.org/Bugs/Public/show_bug.cgi?id=12834

--- Comment #20 from Marat Tanalin | tanalin.com <mtanalin@yandex.ru> 2011-12-04 18:43:49 UTC ---
(In reply to comment #19)

> It's not obvious to me that the only way to achieve the layout effects you
> mention is to put the extra text inside fieldset

Hm, text is not a _solution_ to something here. Texts in the testcases are
means to illustrate spec shortcoming as for LEGEND. So this your phrase is
probably result of some multiple typos or just misunderstanding of the
testcases or of intention of them.

> > If some effect is needed for layout, then it will be achieved _anyway_. And if
> > it cannot be achieved using semantic LEGEND element just because 'spec says
> > this is invalid', then just an other element will be used instead of LEGEND.
> 
> Perhaps. But this might imply a deficiency to be fixed in CSS not HTML. 

CSS currently cannot generate wrappers. On the contrary, we can easily add
wrappers in HTML _right now_. So some potential fixing of CSS in some potential
future is not an equivalent option. Fixing HTML here does not need to implement
_anything_ new in browsers -- it _already_ works and should be just documented
to make pages formally valid.

> > By the way, this rationale is quite clearly described in description (comment 0) of the bug.
> 
> I read Comment 0, but it doesn't describe the semantic relationships in play.
> 
> Perhaps pointing to some real-world designs would help clarify what semantics
> these odd layouts are attempting to visually express?

Initially I've encountered need for arbitrary styling of LEGEND. (I believe
that LEGEND is most appropriate semantic element for use as fieldset header --
for accessibility in particular.) Then, I've discovered that possibilities of
legend styling are considerably differ between browsers. Then I've tried to
wrap legend in DIV to style the wrapper instead of legend itself while still
having LEGEND element for semantics purposes. Then I've discovered that this is
formally invalid though actually perfectly works in real browsers.

The bug itself is about fundamental theoretical issue: instead of requiring an
element to be literally first direct child, it would be much smarter and
practical to define it as "first descendant element [of specific type] in
document tree order". For additional clarification: in terms of JavaScript,
instead of:

fieldset.firstElementChild

we should use:
fieldset.getElementsByTagName('legend').item(0).

We have reasons why the current requirement is bad while not having any serious
reasons why wrapping legend in DIV is bad. It's enough to accept the bug, in my
opinion.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Sunday, 4 December 2011 18:43:52 UTC