Skip to content

Commit eb92e9f

Browse files
committed
Add menu to list of button-type exceptions
1 parent 468c3c3 commit eb92e9f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ function isNode(tagName, value) {
197197
}
198198

199199
if (tagName === 'button') {
200-
return type !== 'submit' && type !== 'reset' && type !== 'button';
200+
return type !== 'menu' &&
201+
type !== 'submit' &&
202+
type !== 'reset' &&
203+
type !== 'button';
201204
}
202205

203206
return 'value' in value;

test.js

+18
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,24 @@ test('hastscript', function (t) {
728728
'a button has a valid type'
729729
);
730730

731+
st.deepEqual(
732+
h('button', {
733+
'type': 'menu',
734+
'value': 'Send'
735+
}),
736+
{
737+
'type': 'element',
738+
'tagName': 'button',
739+
'properties': {
740+
'type': 'menu',
741+
'value': 'Send'
742+
},
743+
'children': []
744+
},
745+
'should *not* allow omitting `properties` when ' +
746+
'a button has a valid type'
747+
);
748+
731749
st.deepEqual(
732750
h('button', {
733751
'type': 'text',

0 commit comments

Comments
 (0)