The default bug view has changed. See this FAQ.

<menuitem>.label should return .textContent if there's no label content attribute

RESOLVED FIXED in mozilla8

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: janv, Assigned: janv)

Tracking

Trunk
mozilla8
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

6 years ago
This is a followup bug from 617528.
Just in case the <menuitem> element won't become void element (bug 676236 and
http://www.w3.org/Bugs/Public/show_bug.cgi?id=13608)

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

it would be nice to support also:
<menu>
  <menuitem>Label</menuitem>
</menu>
(Assignee)

Comment 1

6 years ago
patch coming...
Assignee: nobody → Jan.Varga
(Assignee)

Comment 2

6 years ago
Created attachment 551690 [details] [diff] [review]
patch v1
Attachment #551690 - Flags: review?(Olli.Pettay)
Is there any reason why we don't want to keep consistency with option.label?
Version: unspecified → Trunk
(Assignee)

Comment 4

6 years ago
do you mean the compress whitespace feature ?

Comment 5

6 years ago
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)
(Assignee)

Comment 6

6 years ago
ok, I'll redo it
(Assignee)

Comment 7

6 years ago
Created attachment 552034 [details] [diff] [review]
patch v2
Attachment #551690 - Attachment is obsolete: true
Attachment #551690 - Flags: review?(Olli.Pettay)
Attachment #552034 - Flags: review?(Olli.Pettay)
(Assignee)

Comment 8

6 years ago
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

6 years ago
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");
Attachment #552034 - Flags: review?(Olli.Pettay) → review+
(Assignee)

Comment 10

6 years ago
sure, I'll add it
(Assignee)

Comment 11

6 years ago
http://hg.mozilla.org/mozilla-central/rev/7871abb0e291
Jan, is this bug fixed?

Updated

6 years ago
Keywords: dev-doc-needed
(Assignee)

Comment 13

6 years ago
yes, fixed
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7

Updated

6 years ago
Target Milestone: mozilla7 → mozilla8
Documentation updated:

https://developer.mozilla.org/en/XUL/menuitem
https://developer.mozilla.org/en/XUL/Attribute/label

And updated Firefox 8 for developers.
Keywords: dev-doc-needed → dev-doc-complete
(Assignee)

Comment 15

6 years ago
uhm, this bug is about html <menuitem>, not the xul one
Oops. Undoing that stuff, will try again. :)
Keywords: dev-doc-complete → dev-doc-needed
I'm confused by this. There's no <menuitem> element in the specification, so where does this come from?
We think that the spec should have menuitem.
http://www.w3.org/Bugs/Public/show_bug.cgi?id=13608

If you document this, make sure to mention that spec doesn't have menuitem.
Removing doc-needed; documentation for this will be tracked by bug 676236 instead.
Keywords: dev-doc-needed
Blocks: 712871
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.