Last Comment Bug 677463 - <menuitem>.label should return .textContent if there's no label content attribute
: <menuitem>.label should return .textContent if there's no label content attri...
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla8
Assigned To: Jan Varga [:janv]
: Andrew Overholt [:overholt]
Depends on:
Blocks: 712871
  Show dependency treegraph
Reported: 2011-08-09 00:02 PDT by Jan Varga [:janv]
Modified: 2011-12-22 06:09 PST (History)
6 users (show)
bugzillamozillaorg_serge_20140323: in‑testsuite+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch v1 (7.97 KB, patch)
2011-08-09 00:37 PDT, Jan Varga [:janv]
no flags Details | Diff | Splinter Review
patch v2 (10.31 KB, patch)
2011-08-10 00:24 PDT, Jan Varga [:janv]
bugs: review+
Details | Diff | Splinter Review

Description Jan Varga [:janv] 2011-08-09 00:02:43 PDT
This is a followup bug from 617528.
Just in case the <menuitem> element won't become void element (bug 676236 and

For now, we have to use this syntax:
  <menuitem label="Label"></menuitem>

it would be nice to support also:
Comment 1 Jan Varga [:janv] 2011-08-09 00:05:45 PDT
patch coming...
Comment 2 Jan Varga [:janv] 2011-08-09 00:37:01 PDT
Created attachment 551690 [details] [diff] [review]
patch v1
Comment 3 Mounir Lamouri (:mounir) 2011-08-09 03:00:48 PDT
Is there any reason why we don't want to keep consistency with option.label?
Comment 4 Jan Varga [:janv] 2011-08-09 04:41:45 PDT
do you mean the compress whitespace feature ?
Comment 5 Olli Pettay [:smaug] 2011-08-09 04:42:55 PDT
Yeah, I was proposing to handle menuitem.label like option.label.
The patch adds some tiny inconsistencies.
(But I don't think we need to add .text to the public menuitem API)
Comment 6 Jan Varga [:janv] 2011-08-09 05:31:33 PDT
ok, I'll redo it
Comment 7 Jan Varga [:janv] 2011-08-10 00:24:34 PDT
Created attachment 552034 [details] [diff] [review]
patch v2
Comment 8 Jan Varga [:janv] 2011-08-10 00:36:52 PDT
Comment on attachment 552034 [details] [diff] [review]
patch v2

>+    <menuitem>Item w/ textContent</menuitem>

I put a space before "Item w/ textContent" to improve automatic testing.

>   return rv;
> }
> NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLMenuItemElement, Type, type,

I put back the empty line.
Comment 9 Olli Pettay [:smaug] 2011-08-10 03:22:32 PDT
Comment on attachment 552034 [details] [diff] [review]
patch v2

Would be great if you could add still some tests
which make sure that option.label handling stays the same
as menuitem.label.

Something like
var o = document.createElement("option");
var m = document.createElement("menuitem");
is(o.label, m.label, "Should have same labels");
o.textContent = "   ";
is(o.label, m.label, "Should have same labels");
o.textContent = "foo";
isnot(o.label, m.label, "Shouldn't have same labels");
m.textContent = "foo";
is(o.label, m.label, "Should have same labels");
m.label = "bar";
isnot(o.label, m.label, "Shouldn't have same labels");
o.label = "bar";
is(o.label, m.label, "Should have same labels");
Comment 10 Jan Varga [:janv] 2011-08-10 04:06:37 PDT
sure, I'll add it
Comment 11 Jan Varga [:janv] 2011-08-11 04:41:17 PDT
Comment 12 :Ms2ger (⌚ UTC+1/+2) 2011-08-13 06:35:20 PDT
Jan, is this bug fixed?
Comment 13 Jan Varga [:janv] 2011-08-13 10:09:56 PDT
yes, fixed
Comment 14 Eric Shepherd [:sheppy] 2011-09-02 13:30:56 PDT
Documentation updated:

And updated Firefox 8 for developers.
Comment 15 Jan Varga [:janv] 2011-09-02 13:48:35 PDT
uhm, this bug is about html <menuitem>, not the xul one
Comment 16 Eric Shepherd [:sheppy] 2011-09-02 21:12:00 PDT
Oops. Undoing that stuff, will try again. :)
Comment 17 Eric Shepherd [:sheppy] 2011-10-17 11:34:54 PDT
I'm confused by this. There's no <menuitem> element in the specification, so where does this come from?
Comment 18 Olli Pettay [:smaug] 2011-10-17 11:41:32 PDT
We think that the spec should have menuitem.

If you document this, make sure to mention that spec doesn't have menuitem.
Comment 19 Eric Shepherd [:sheppy] 2011-10-18 13:35:44 PDT
Removing doc-needed; documentation for this will be tracked by bug 676236 instead.

Note You need to log in before you can comment on or make changes to this bug.