Closed Bug 677463 Opened 13 years ago Closed 13 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: janv, Assigned: janv)

References

Details

Attachments

(1 file, 1 obsolete file)

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>
patch coming...
Assignee: nobody → Jan.Varga
Attached patch patch v1 (obsolete) — Splinter Review
Attachment #551690 - Flags: review?(Olli.Pettay)
Is there any reason why we don't want to keep consistency with option.label?
Version: unspecified → Trunk
do you mean the compress whitespace feature ?
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)
ok, I'll redo it
Attached patch patch v2Splinter Review
Attachment #551690 - Attachment is obsolete: true
Attachment #551690 - Flags: review?(Olli.Pettay)
Attachment #552034 - Flags: review?(Olli.Pettay)
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 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+
sure, I'll add it
Jan, is this bug fixed?
yes, fixed
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Target Milestone: mozilla7 → mozilla8
uhm, this bug is about html <menuitem>, not the xul one
Oops. Undoing that stuff, will try again. :)
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.

Attachment

General

Created:
Updated:
Size: