File tree 3 files changed +17
-5
lines changed
crates/swc_ecma_transforms_react
tests/jsx/fixture/issue-6931
3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -1336,15 +1336,19 @@ fn count_children(children: &[JSXElementChild]) -> usize {
1336
1336
fn transform_jsx_attr_str ( v : & str ) -> String {
1337
1337
let single_quote = false ;
1338
1338
let mut buf = String :: with_capacity ( v. len ( ) ) ;
1339
+ let mut iter = v. chars ( ) . peekable ( ) ;
1339
1340
1340
- for c in v . chars ( ) {
1341
+ while let Some ( c ) = iter . next ( ) {
1341
1342
match c {
1342
1343
'\u{0008}' => buf. push_str ( "\\ b" ) ,
1343
1344
'\u{000c}' => buf. push_str ( "\\ f" ) ,
1344
- ' ' | '\n' | '\r' | '\t' => {
1345
- if buf. ends_with ( ' ' ) {
1346
- } else {
1347
- buf. push ( ' ' )
1345
+ ' ' => buf. push ( ' ' ) ,
1346
+
1347
+ '\n' | '\r' | '\t' => {
1348
+ buf. push ( ' ' ) ;
1349
+
1350
+ while let Some ( ' ' ) = iter. peek ( ) {
1351
+ iter. next ( ) ;
1348
1352
}
1349
1353
}
1350
1354
'\u{000b}' => buf. push_str ( "\\ v" ) ,
Original file line number Diff line number Diff line change
1
+ const f1 = < Component on = { " " } />
2
+ const f2 = < Component on = " " />
Original file line number Diff line number Diff line change
1
+ const f1 = /*#__PURE__*/ React . createElement ( Component , {
2
+ on : " "
3
+ } ) ;
4
+ const f2 = /*#__PURE__*/ React . createElement ( Component , {
5
+ on : " "
6
+ } ) ;
You can’t perform that action at this time.
0 commit comments