<!DOCTYPE html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<menuitem id='item1' label='item1'></menuitem>
<menuitem id='item2'>item2</menuitem>
<menuitem id='item3'>   item     3   </menuitem>
<menuitem id='item4' label=''>item4</menuitem>
<menuitem id='item5' label='  item  5  '></menuitem>

<script>
test(() => {
  assert_equals(document.querySelector('#item1').label, 'item1');
  assert_equals(document.querySelector('#item2').label, 'item2');
  assert_equals(document.querySelector('#item3').label, 'item 3');
  assert_equals(document.querySelector('#item4').label, '');
  assert_equals(document.querySelector('#item5').label, '  item  5  ');
}, 'Menuitem.label should be the label attribute content or the result of '
 + 'stripping and collapsing ASCII whitespace from the child text content.');
</script>
