File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -996,7 +996,7 @@ module.exports = grammar({
996996 jsx_opening_element : $ => prec . dynamic ( - 1 , seq (
997997 '<' ,
998998 field ( 'name' , $ . _jsx_element_name ) ,
999- repeat ( field ( 'attribute' , $ . jsx_attribute ) ) ,
999+ repeat ( field ( 'attribute' , $ . _jsx_attribute ) ) ,
10001000 '>'
10011001 ) ) ,
10021002
@@ -1026,13 +1026,15 @@ module.exports = grammar({
10261026 jsx_self_closing_element : $ => seq (
10271027 '<' ,
10281028 field ( 'name' , $ . _jsx_element_name ) ,
1029- repeat ( field ( 'attribute' , $ . jsx_attribute ) ) ,
1029+ repeat ( field ( 'attribute' , $ . _jsx_attribute ) ) ,
10301030 '/' ,
10311031 '>'
10321032 ) ,
10331033
10341034 _jsx_attribute_name : $ => alias ( $ . value_identifier , $ . property_identifier ) ,
10351035
1036+ _jsx_attribute : $ => choice ( $ . jsx_attribute , $ . jsx_expression ) ,
1037+
10361038 jsx_attribute : $ => seq (
10371039 optional ( '?' ) ,
10381040 $ . _jsx_attribute_name ,
Original file line number Diff line number Diff line change @@ -218,3 +218,24 @@ Attribute Block
218218 (jsx_identifier))
219219 (jsx_closing_element
220220 (jsx_identifier)))))
221+
222+ ===================================================
223+ Spread props
224+ ===================================================
225+
226+ <div {...a}/>
227+ <Comp {...a}></Comp>
228+
229+ ---
230+
231+ (source_file
232+ (expression_statement
233+ (jsx_self_closing_element
234+ (jsx_identifier)
235+ (jsx_expression
236+ (spread_element (value_identifier)))))
237+ (expression_statement
238+ (jsx_element
239+ (jsx_opening_element (jsx_identifier)
240+ (jsx_expression (spread_element (value_identifier))))
241+ (jsx_closing_element (jsx_identifier)))))
You can’t perform that action at this time.
0 commit comments