W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2014

Re: [whatwg] Need clarification on menu builder algorithm for contextmenu attribute

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 26 Aug 2014 20:44:41 +0000 (UTC)
To: Sanjoy Pal <sanjoy.pal@samsung.com>
Message-ID: <alpine.DEB.2.00.1408262015220.2532@ps20323.dreamhostps.com>
Cc: whatwg@whatwg.org
On Tue, 26 Aug 2014, Sanjoy Pal wrote:
> 
> I feel the following statement for the third bullet of step 2,
> 
> "if the child is a menu element with no label attribute, Append a 
> separator to the menu, then run the menu builder steps using this child 
> menu element for the same menu, then append another separator to the 
> menu."
> 
> is contradicting the statement of step 3
> 
> "Remove any submenu with no label, or whose label is the empty string, 
> in the menu or any submenus."
> 
> My understanding from the first statement is that the any child menu 
> (submenu) with no label attribute should be flattened. But the 
> subsequent statement implies removal of whole submenu.

It's important not to confuse a child <menu> element with an actual 
submenu in the constructed menu. (This is similar to the difference 
between a "section" and a <section>.)

There are two concepts here. Elements, including <menu> and <menuitem>, 
are your regular DOM element node. Pop-up menus, on the other hand, are 
lists of zero or more menu items, and menu items are commands, separators, 
and recursively other pop-up menus.

When you have a child <menu> element with no label attribute, no submenu 
is created. The child menu items are inserted directly into the parent 
menu. So when it comes to the second statement quoted above, there's no 
submenu to remove. The second statement above could get triggered for 
something like <menu label=""> (an empty label).

I've tweaked the wording a bit to try to make this clearer. In particular 
I've made the terminology less ambiguous.

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 26 August 2014 20:45:05 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:22 UTC