W3C home > Mailing lists > Public > public-html@w3.org > March 2014

Menuitem's content model

From: Andry Rendy <master.skywalker.88@gmail.com>
Date: Fri, 28 Mar 2014 09:56:00 +0100
Message-ID: <CAGxST9mzWv_aiXD6Br_kc=uDYrUzucOdkNRb8GLDN3jsBj0sMQ@mail.gmail.com>
To: public-html@w3.org
To the attention of interested parties.
In several occasions I tried to figure out what was wrong with <menuitem>
element and its structure, but it seems that I was unlucky until now, as it
happened with my previous message here in this list. Now I try again.
Since its creation, the <menuitem> element has been in the category of
"void" elements, i.e. elements which do not have content and, as such, only
consist of a starting tag in the markup.
This is strange. <menuitem> is a brand new element in the spec. Only old
versions of Internet Explorer treat ALL unknown tags as void, but as
everybody knows this can be easily worked around with javascript
document.createElement('newelement'). The other user agents, which are
quite used to the awful habit of certain authors not to close most of the
elements they open, treat unknown elements as normal elements whose end tag
has been omitted and close them in a way they consider proper.
In this context, this means that a markup such as
which is correct according to the specs (apart from the attribute
omission), ends up being interpreted as it were written like this (tags in
brackets are those UAs consider omitted)
effectively producing a dom which can be represented like this:
This is clearly incorrect. Now, I know that both the specification and the
validator (who deserves an argument apart, see below) flag the use of
<menu> element with a "warning", advising the authors to wait future wider
implementations. But it wouldn't be strange for programmers to produce a
polyfill enabling the function of this element already now, so that authors
can start using the context menu and the toolbar at last! I would also add
that without examples in the wild, no tests will be really possible about
this element's viability. And even without this case, the problem will show
again in the future, reversed, in the form of backward compatibility.
I also notice that, having the menuitem finally promoted in its natural
category of normal elements as it should be, it could also have a "content
model", limited to "text". The <option> element teaches us that what can be
done via a "label" attribute can be achieved even better by the proper
textContent of the element itself. Of course the argument above, regarding
the re-insertion of menuitem in the group of normal elements, remains valid
even with "content model: empty". It's just a matter of fixing two errors
with one choice, because both having it void and empty seem unreasonable to
One final note: the Validator parsing engine makes the same mistake that
browsers do, flagging the (now) "correct" use of <menuitem> as an error:
"Unclosed element menuitem". Nobody seemed interested in it, even if I
filed the bug twice.
Awaiting further discussion.
Received on Friday, 28 March 2014 08:56:27 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:38 UTC