ripple 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/package.json +3 -2
- package/src/constants.js +4 -0
- package/src/jsx-runtime.d.ts +12 -2
- package/src/runtime/internal/client/constants.js +6 -0
- package/src/runtime/internal/client/for.js +224 -50
- package/src/runtime/internal/client/hydration.js +0 -16
- package/src/runtime/internal/client/index.js +2 -2
- package/src/runtime/internal/client/operations.js +1 -2
- package/src/runtime/internal/client/render.js +42 -4
- package/src/runtime/internal/client/runtime.js +45 -2
- package/src/runtime/internal/server/index.js +11 -6
- package/tests/client/basic/basic.attributes.test.tsrx +37 -0
- package/tests/client/compiler/compiler.basic.test.tsrx +2 -2
- package/tests/client/for-item.test.tsrx +404 -0
- package/tests/hydration/compiled/client/basic.js +29 -55
- package/tests/hydration/compiled/client/events.js +80 -67
- package/tests/hydration/compiled/client/for.js +95 -80
- package/tests/hydration/compiled/client/fragment-cursor.js +412 -344
- package/tests/hydration/compiled/client/head.js +4 -7
- package/tests/hydration/compiled/client/html.js +40 -64
- package/tests/hydration/compiled/client/if-children.js +30 -34
- package/tests/hydration/compiled/client/if-fragment-controlflow.js +7 -7
- package/tests/hydration/compiled/client/if.js +4 -4
- package/tests/hydration/compiled/client/mixed-control-flow.js +20 -50
- package/tests/hydration/compiled/client/nested-control-flow.js +97 -185
- package/tests/hydration/compiled/client/portal.js +2 -2
- package/tests/hydration/compiled/client/reactivity.js +17 -31
- package/tests/hydration/compiled/client/streaming.js +4 -8
- package/tests/hydration/compiled/client/typed-text.js +4 -15
- package/tests/hydration/compiled/server/events.js +5 -53
- package/tests/hydration/compiled/server/for.js +1 -9
- package/tests/hydration/compiled/server/fragment-cursor.js +36 -324
- package/tests/server/basic.attributes.test.tsrx +28 -0
- package/tests/server/basic.test.tsrx +23 -0
- package/tests/utils/jsx-runtime-types.test.js +67 -2
- package/tests/utils/tracked-types.test.js +117 -0
- package/types/index.d.ts +7 -8
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.rsrx.snap +0 -12
- package/tests/client/compiler/__snapshots__/compiler.typescript.test.rsrx.snap +0 -46
|
@@ -21,15 +21,7 @@ export function TrailingNavigatedElements() {
|
|
|
21
21
|
_$_.regular_block(() => {
|
|
22
22
|
let __out = '';
|
|
23
23
|
|
|
24
|
-
__out += '<div class="count">';
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
_$_.output_push(__out);
|
|
28
|
-
__out = '';
|
|
29
|
-
_$_.render_expression(n.value);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
__out += '</div><button class="inc">inc</button><button class="dec">dec</button>';
|
|
24
|
+
__out += '<div class="count">' + _$_.escape(n.value) + '</div><button class="inc">inc</button><button class="dec">dec</button>';
|
|
33
25
|
_$_.output_push(__out);
|
|
34
26
|
});
|
|
35
27
|
});
|
|
@@ -293,15 +285,7 @@ export function WrapTrailingNavigatedElements() {
|
|
|
293
285
|
_$_.render_component(comp, ...args);
|
|
294
286
|
}
|
|
295
287
|
|
|
296
|
-
__out += '<span class="after">';
|
|
297
|
-
|
|
298
|
-
{
|
|
299
|
-
_$_.output_push(__out);
|
|
300
|
-
__out = '';
|
|
301
|
-
_$_.render_expression(n.value);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
288
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
305
289
|
_$_.output_push(__out);
|
|
306
290
|
});
|
|
307
291
|
});
|
|
@@ -325,15 +309,7 @@ export function WrapTrailingStaticNavigatedElements() {
|
|
|
325
309
|
_$_.render_component(comp, ...args);
|
|
326
310
|
}
|
|
327
311
|
|
|
328
|
-
__out += '<span class="after">';
|
|
329
|
-
|
|
330
|
-
{
|
|
331
|
-
_$_.output_push(__out);
|
|
332
|
-
__out = '';
|
|
333
|
-
_$_.render_expression(n.value);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
312
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
337
313
|
_$_.output_push(__out);
|
|
338
314
|
});
|
|
339
315
|
});
|
|
@@ -357,15 +333,7 @@ export function WrapNavigatedThenStatic() {
|
|
|
357
333
|
_$_.render_component(comp, ...args);
|
|
358
334
|
}
|
|
359
335
|
|
|
360
|
-
__out += '<span class="after">';
|
|
361
|
-
|
|
362
|
-
{
|
|
363
|
-
_$_.output_push(__out);
|
|
364
|
-
__out = '';
|
|
365
|
-
_$_.render_expression(n.value);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
336
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
369
337
|
_$_.output_push(__out);
|
|
370
338
|
});
|
|
371
339
|
});
|
|
@@ -389,15 +357,7 @@ export function WrapLeadingNavigatedThenStatic() {
|
|
|
389
357
|
_$_.render_component(comp, ...args);
|
|
390
358
|
}
|
|
391
359
|
|
|
392
|
-
__out += '<span class="after">';
|
|
393
|
-
|
|
394
|
-
{
|
|
395
|
-
_$_.output_push(__out);
|
|
396
|
-
__out = '';
|
|
397
|
-
_$_.render_expression(n.value);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
360
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
401
361
|
_$_.output_push(__out);
|
|
402
362
|
});
|
|
403
363
|
});
|
|
@@ -421,15 +381,7 @@ export function WrapTrailingNestedNavigated() {
|
|
|
421
381
|
_$_.render_component(comp, ...args);
|
|
422
382
|
}
|
|
423
383
|
|
|
424
|
-
__out += '<span class="after">';
|
|
425
|
-
|
|
426
|
-
{
|
|
427
|
-
_$_.output_push(__out);
|
|
428
|
-
__out = '';
|
|
429
|
-
_$_.render_expression(n.value);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
384
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
433
385
|
_$_.output_push(__out);
|
|
434
386
|
});
|
|
435
387
|
});
|
|
@@ -453,15 +405,7 @@ export function WrapNestedNavigatedThenStatic() {
|
|
|
453
405
|
_$_.render_component(comp, ...args);
|
|
454
406
|
}
|
|
455
407
|
|
|
456
|
-
__out += '<span class="after">';
|
|
457
|
-
|
|
458
|
-
{
|
|
459
|
-
_$_.output_push(__out);
|
|
460
|
-
__out = '';
|
|
461
|
-
_$_.render_expression(n.value);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
408
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
465
409
|
_$_.output_push(__out);
|
|
466
410
|
});
|
|
467
411
|
});
|
|
@@ -485,15 +429,7 @@ export function WrapTrackedTextThenStatic() {
|
|
|
485
429
|
_$_.render_component(comp, ...args);
|
|
486
430
|
}
|
|
487
431
|
|
|
488
|
-
__out += '<span class="after">';
|
|
489
|
-
|
|
490
|
-
{
|
|
491
|
-
_$_.output_push(__out);
|
|
492
|
-
__out = '';
|
|
493
|
-
_$_.render_expression(n.value);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
432
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
497
433
|
_$_.output_push(__out);
|
|
498
434
|
});
|
|
499
435
|
});
|
|
@@ -517,15 +453,7 @@ export function WrapStaticThenTrackedText() {
|
|
|
517
453
|
_$_.render_component(comp, ...args);
|
|
518
454
|
}
|
|
519
455
|
|
|
520
|
-
__out += '<span class="after">';
|
|
521
|
-
|
|
522
|
-
{
|
|
523
|
-
_$_.output_push(__out);
|
|
524
|
-
__out = '';
|
|
525
|
-
_$_.render_expression(n.value);
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
456
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
529
457
|
_$_.output_push(__out);
|
|
530
458
|
});
|
|
531
459
|
});
|
|
@@ -549,15 +477,7 @@ export function WrapStaticNestedThenStatic() {
|
|
|
549
477
|
_$_.render_component(comp, ...args);
|
|
550
478
|
}
|
|
551
479
|
|
|
552
|
-
__out += '<span class="after">';
|
|
553
|
-
|
|
554
|
-
{
|
|
555
|
-
_$_.output_push(__out);
|
|
556
|
-
__out = '';
|
|
557
|
-
_$_.render_expression(n.value);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
480
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
561
481
|
_$_.output_push(__out);
|
|
562
482
|
});
|
|
563
483
|
});
|
|
@@ -581,15 +501,7 @@ export function WrapAllStatic() {
|
|
|
581
501
|
_$_.render_component(comp, ...args);
|
|
582
502
|
}
|
|
583
503
|
|
|
584
|
-
__out += '<span class="after">';
|
|
585
|
-
|
|
586
|
-
{
|
|
587
|
-
_$_.output_push(__out);
|
|
588
|
-
__out = '';
|
|
589
|
-
_$_.render_expression(n.value);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
504
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
593
505
|
_$_.output_push(__out);
|
|
594
506
|
});
|
|
595
507
|
});
|
|
@@ -613,15 +525,7 @@ export function WrapTrailingDynamicChild() {
|
|
|
613
525
|
_$_.render_component(comp, ...args);
|
|
614
526
|
}
|
|
615
527
|
|
|
616
|
-
__out += '<span class="after">';
|
|
617
|
-
|
|
618
|
-
{
|
|
619
|
-
_$_.output_push(__out);
|
|
620
|
-
__out = '';
|
|
621
|
-
_$_.render_expression(n.value);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
528
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
625
529
|
_$_.output_push(__out);
|
|
626
530
|
});
|
|
627
531
|
});
|
|
@@ -645,15 +549,7 @@ export function WrapDynamicChildThenStatic() {
|
|
|
645
549
|
_$_.render_component(comp, ...args);
|
|
646
550
|
}
|
|
647
551
|
|
|
648
|
-
__out += '<span class="after">';
|
|
649
|
-
|
|
650
|
-
{
|
|
651
|
-
_$_.output_push(__out);
|
|
652
|
-
__out = '';
|
|
653
|
-
_$_.render_expression(n.value);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
552
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
657
553
|
_$_.output_push(__out);
|
|
658
554
|
});
|
|
659
555
|
});
|
|
@@ -677,15 +573,7 @@ export function WrapIfThenStatic() {
|
|
|
677
573
|
_$_.render_component(comp, ...args);
|
|
678
574
|
}
|
|
679
575
|
|
|
680
|
-
__out += '<span class="after">';
|
|
681
|
-
|
|
682
|
-
{
|
|
683
|
-
_$_.output_push(__out);
|
|
684
|
-
__out = '';
|
|
685
|
-
_$_.render_expression(n.value);
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
576
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
689
577
|
_$_.output_push(__out);
|
|
690
578
|
});
|
|
691
579
|
});
|
|
@@ -709,15 +597,7 @@ export function WrapStaticThenIf() {
|
|
|
709
597
|
_$_.render_component(comp, ...args);
|
|
710
598
|
}
|
|
711
599
|
|
|
712
|
-
__out += '<span class="after">';
|
|
713
|
-
|
|
714
|
-
{
|
|
715
|
-
_$_.output_push(__out);
|
|
716
|
-
__out = '';
|
|
717
|
-
_$_.render_expression(n.value);
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
600
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
721
601
|
_$_.output_push(__out);
|
|
722
602
|
});
|
|
723
603
|
});
|
|
@@ -741,15 +621,7 @@ export function WrapCompThenStatic() {
|
|
|
741
621
|
_$_.render_component(comp, ...args);
|
|
742
622
|
}
|
|
743
623
|
|
|
744
|
-
__out += '<span class="after">';
|
|
745
|
-
|
|
746
|
-
{
|
|
747
|
-
_$_.output_push(__out);
|
|
748
|
-
__out = '';
|
|
749
|
-
_$_.render_expression(n.value);
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
624
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
753
625
|
_$_.output_push(__out);
|
|
754
626
|
});
|
|
755
627
|
});
|
|
@@ -773,15 +645,7 @@ export function WrapStaticThenComp() {
|
|
|
773
645
|
_$_.render_component(comp, ...args);
|
|
774
646
|
}
|
|
775
647
|
|
|
776
|
-
__out += '<span class="after">';
|
|
777
|
-
|
|
778
|
-
{
|
|
779
|
-
_$_.output_push(__out);
|
|
780
|
-
__out = '';
|
|
781
|
-
_$_.render_expression(n.value);
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
648
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
785
649
|
_$_.output_push(__out);
|
|
786
650
|
});
|
|
787
651
|
});
|
|
@@ -805,15 +669,7 @@ export function WrapSiblingComps() {
|
|
|
805
669
|
_$_.render_component(comp, ...args);
|
|
806
670
|
}
|
|
807
671
|
|
|
808
|
-
__out += '<span class="after">';
|
|
809
|
-
|
|
810
|
-
{
|
|
811
|
-
_$_.output_push(__out);
|
|
812
|
-
__out = '';
|
|
813
|
-
_$_.render_expression(n.value);
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
672
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
817
673
|
_$_.output_push(__out);
|
|
818
674
|
});
|
|
819
675
|
});
|
|
@@ -854,15 +710,7 @@ export function TrailingNestedFragment() {
|
|
|
854
710
|
_$_.regular_block(() => {
|
|
855
711
|
let __out = '';
|
|
856
712
|
|
|
857
|
-
__out += '<div class="count">';
|
|
858
|
-
|
|
859
|
-
{
|
|
860
|
-
_$_.output_push(__out);
|
|
861
|
-
__out = '';
|
|
862
|
-
_$_.render_expression(n.value);
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
__out += '</div><span class="x">x</span><button class="inc">inc</button>';
|
|
713
|
+
__out += '<div class="count">' + _$_.escape(n.value) + '</div><span class="x">x</span><button class="inc">inc</button>';
|
|
866
714
|
_$_.output_push(__out);
|
|
867
715
|
});
|
|
868
716
|
});
|
|
@@ -1034,15 +882,7 @@ export function WrapUntrackedTextThenStatic() {
|
|
|
1034
882
|
_$_.render_component(comp, ...args);
|
|
1035
883
|
}
|
|
1036
884
|
|
|
1037
|
-
__out += '<span class="after">';
|
|
1038
|
-
|
|
1039
|
-
{
|
|
1040
|
-
_$_.output_push(__out);
|
|
1041
|
-
__out = '';
|
|
1042
|
-
_$_.render_expression(n.value);
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
885
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1046
886
|
_$_.output_push(__out);
|
|
1047
887
|
});
|
|
1048
888
|
});
|
|
@@ -1066,15 +906,7 @@ export function WrapNestedFragmentThenStatic() {
|
|
|
1066
906
|
_$_.render_component(comp, ...args);
|
|
1067
907
|
}
|
|
1068
908
|
|
|
1069
|
-
__out += '<span class="after">';
|
|
1070
|
-
|
|
1071
|
-
{
|
|
1072
|
-
_$_.output_push(__out);
|
|
1073
|
-
__out = '';
|
|
1074
|
-
_$_.render_expression(n.value);
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
909
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1078
910
|
_$_.output_push(__out);
|
|
1079
911
|
});
|
|
1080
912
|
});
|
|
@@ -1098,15 +930,7 @@ export function WrapTrailingNestedFragment() {
|
|
|
1098
930
|
_$_.render_component(comp, ...args);
|
|
1099
931
|
}
|
|
1100
932
|
|
|
1101
|
-
__out += '<span class="after">';
|
|
1102
|
-
|
|
1103
|
-
{
|
|
1104
|
-
_$_.output_push(__out);
|
|
1105
|
-
__out = '';
|
|
1106
|
-
_$_.render_expression(n.value);
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
933
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1110
934
|
_$_.output_push(__out);
|
|
1111
935
|
});
|
|
1112
936
|
});
|
|
@@ -1130,15 +954,7 @@ export function WrapForThenStatic() {
|
|
|
1130
954
|
_$_.render_component(comp, ...args);
|
|
1131
955
|
}
|
|
1132
956
|
|
|
1133
|
-
__out += '<span class="after">';
|
|
1134
|
-
|
|
1135
|
-
{
|
|
1136
|
-
_$_.output_push(__out);
|
|
1137
|
-
__out = '';
|
|
1138
|
-
_$_.render_expression(n.value);
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
957
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1142
958
|
_$_.output_push(__out);
|
|
1143
959
|
});
|
|
1144
960
|
});
|
|
@@ -1162,15 +978,7 @@ export function WrapSwitchThenStatic() {
|
|
|
1162
978
|
_$_.render_component(comp, ...args);
|
|
1163
979
|
}
|
|
1164
980
|
|
|
1165
|
-
__out += '<span class="after">';
|
|
1166
|
-
|
|
1167
|
-
{
|
|
1168
|
-
_$_.output_push(__out);
|
|
1169
|
-
__out = '';
|
|
1170
|
-
_$_.render_expression(n.value);
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
981
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1174
982
|
_$_.output_push(__out);
|
|
1175
983
|
});
|
|
1176
984
|
});
|
|
@@ -1194,15 +1002,7 @@ export function WrapTryThenStatic() {
|
|
|
1194
1002
|
_$_.render_component(comp, ...args);
|
|
1195
1003
|
}
|
|
1196
1004
|
|
|
1197
|
-
__out += '<span class="after">';
|
|
1198
|
-
|
|
1199
|
-
{
|
|
1200
|
-
_$_.output_push(__out);
|
|
1201
|
-
__out = '';
|
|
1202
|
-
_$_.render_expression(n.value);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1005
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1206
1006
|
_$_.output_push(__out);
|
|
1207
1007
|
});
|
|
1208
1008
|
});
|
|
@@ -1226,15 +1026,7 @@ export function WrapStyleThenStatic() {
|
|
|
1226
1026
|
_$_.render_component(comp, ...args);
|
|
1227
1027
|
}
|
|
1228
1028
|
|
|
1229
|
-
__out += '<span class="after">';
|
|
1230
|
-
|
|
1231
|
-
{
|
|
1232
|
-
_$_.output_push(__out);
|
|
1233
|
-
__out = '';
|
|
1234
|
-
_$_.render_expression(n.value);
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1029
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1238
1030
|
_$_.output_push(__out);
|
|
1239
1031
|
});
|
|
1240
1032
|
});
|
|
@@ -1258,15 +1050,7 @@ export function WrapCollectionThenStatic() {
|
|
|
1258
1050
|
_$_.render_component(comp, ...args);
|
|
1259
1051
|
}
|
|
1260
1052
|
|
|
1261
|
-
__out += '<span class="after">';
|
|
1262
|
-
|
|
1263
|
-
{
|
|
1264
|
-
_$_.output_push(__out);
|
|
1265
|
-
__out = '';
|
|
1266
|
-
_$_.render_expression(n.value);
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1053
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1270
1054
|
_$_.output_push(__out);
|
|
1271
1055
|
});
|
|
1272
1056
|
});
|
|
@@ -1290,15 +1074,7 @@ export function WrapInlineElementThenStatic() {
|
|
|
1290
1074
|
_$_.render_component(comp, ...args);
|
|
1291
1075
|
}
|
|
1292
1076
|
|
|
1293
|
-
__out += '<span class="after">';
|
|
1294
|
-
|
|
1295
|
-
{
|
|
1296
|
-
_$_.output_push(__out);
|
|
1297
|
-
__out = '';
|
|
1298
|
-
_$_.render_expression(n.value);
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1077
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1302
1078
|
_$_.output_push(__out);
|
|
1303
1079
|
});
|
|
1304
1080
|
});
|
|
@@ -1379,15 +1155,7 @@ export function WrapIfOnly() {
|
|
|
1379
1155
|
_$_.render_component(comp, ...args);
|
|
1380
1156
|
}
|
|
1381
1157
|
|
|
1382
|
-
__out += '<span class="after">';
|
|
1383
|
-
|
|
1384
|
-
{
|
|
1385
|
-
_$_.output_push(__out);
|
|
1386
|
-
__out = '';
|
|
1387
|
-
_$_.render_expression(n.value);
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1158
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1391
1159
|
_$_.output_push(__out);
|
|
1392
1160
|
});
|
|
1393
1161
|
});
|
|
@@ -1411,15 +1179,7 @@ export function WrapIfThenOne() {
|
|
|
1411
1179
|
_$_.render_component(comp, ...args);
|
|
1412
1180
|
}
|
|
1413
1181
|
|
|
1414
|
-
__out += '<span class="after">';
|
|
1415
|
-
|
|
1416
|
-
{
|
|
1417
|
-
_$_.output_push(__out);
|
|
1418
|
-
__out = '';
|
|
1419
|
-
_$_.render_expression(n.value);
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1182
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1423
1183
|
_$_.output_push(__out);
|
|
1424
1184
|
});
|
|
1425
1185
|
});
|
|
@@ -1443,15 +1203,7 @@ export function WrapSingleRootWithIf() {
|
|
|
1443
1203
|
_$_.render_component(comp, ...args);
|
|
1444
1204
|
}
|
|
1445
1205
|
|
|
1446
|
-
__out += '<span class="after">';
|
|
1447
|
-
|
|
1448
|
-
{
|
|
1449
|
-
_$_.output_push(__out);
|
|
1450
|
-
__out = '';
|
|
1451
|
-
_$_.render_expression(n.value);
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1206
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1455
1207
|
_$_.output_push(__out);
|
|
1456
1208
|
});
|
|
1457
1209
|
});
|
|
@@ -1469,15 +1221,7 @@ export function ExprThenSiblingInDiv() {
|
|
|
1469
1221
|
_$_.output_push(__out);
|
|
1470
1222
|
__out = '';
|
|
1471
1223
|
_$_.render_expression(label.toUpperCase());
|
|
1472
|
-
__out += '<span class="after">';
|
|
1473
|
-
|
|
1474
|
-
{
|
|
1475
|
-
_$_.output_push(__out);
|
|
1476
|
-
__out = '';
|
|
1477
|
-
_$_.render_expression(n.value);
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1224
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1481
1225
|
_$_.output_push(__out);
|
|
1482
1226
|
});
|
|
1483
1227
|
});
|
|
@@ -1515,15 +1259,7 @@ export function IfTwoInDiv() {
|
|
|
1515
1259
|
__out += '<b class="if">x</b><i class="if2">y</i>';
|
|
1516
1260
|
}
|
|
1517
1261
|
|
|
1518
|
-
__out += '<!--]--><span class="after">';
|
|
1519
|
-
|
|
1520
|
-
{
|
|
1521
|
-
_$_.output_push(__out);
|
|
1522
|
-
__out = '';
|
|
1523
|
-
_$_.render_expression(n.value);
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1262
|
+
__out += '<!--]--><span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1527
1263
|
_$_.output_push(__out);
|
|
1528
1264
|
});
|
|
1529
1265
|
});
|
|
@@ -1547,15 +1283,7 @@ export function WrapIfTwoThenStatic() {
|
|
|
1547
1283
|
_$_.render_component(comp, ...args);
|
|
1548
1284
|
}
|
|
1549
1285
|
|
|
1550
|
-
__out += '<span class="after">';
|
|
1551
|
-
|
|
1552
|
-
{
|
|
1553
|
-
_$_.output_push(__out);
|
|
1554
|
-
__out = '';
|
|
1555
|
-
_$_.render_expression(n.value);
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1286
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1559
1287
|
_$_.output_push(__out);
|
|
1560
1288
|
});
|
|
1561
1289
|
});
|
|
@@ -1640,15 +1368,7 @@ export function WrapStaticCallThenStatic() {
|
|
|
1640
1368
|
_$_.render_component(comp, ...args);
|
|
1641
1369
|
}
|
|
1642
1370
|
|
|
1643
|
-
__out += '<span class="after">';
|
|
1644
|
-
|
|
1645
|
-
{
|
|
1646
|
-
_$_.output_push(__out);
|
|
1647
|
-
__out = '';
|
|
1648
|
-
_$_.render_expression(n.value);
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1371
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1652
1372
|
_$_.output_push(__out);
|
|
1653
1373
|
});
|
|
1654
1374
|
});
|
|
@@ -1672,15 +1392,7 @@ export function WrapStaticThenStyleThenStatic() {
|
|
|
1672
1392
|
_$_.render_component(comp, ...args);
|
|
1673
1393
|
}
|
|
1674
1394
|
|
|
1675
|
-
__out += '<span class="after">';
|
|
1676
|
-
|
|
1677
|
-
{
|
|
1678
|
-
_$_.output_push(__out);
|
|
1679
|
-
__out = '';
|
|
1680
|
-
_$_.render_expression(n.value);
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
__out += '</span><button class="outer-inc">outer</button></div>';
|
|
1395
|
+
__out += '<span class="after">' + _$_.escape(n.value) + '</span><button class="outer-inc">outer</button></div>';
|
|
1684
1396
|
_$_.output_push(__out);
|
|
1685
1397
|
});
|
|
1686
1398
|
});
|
|
@@ -235,6 +235,34 @@ describe('basic server > attribute rendering', () => {
|
|
|
235
235
|
expect(div.style.fontWeight).toBe('bold');
|
|
236
236
|
});
|
|
237
237
|
|
|
238
|
+
it.each([undefined, null])('omits %s style values from HTML and SVG attributes', async (
|
|
239
|
+
empty,
|
|
240
|
+
) => {
|
|
241
|
+
function Basic() @{
|
|
242
|
+
const styles = {
|
|
243
|
+
width: empty,
|
|
244
|
+
'--scale': empty,
|
|
245
|
+
margin: 0,
|
|
246
|
+
opacity: 0,
|
|
247
|
+
'--literal': 'undefined',
|
|
248
|
+
'--literal-null': 'null',
|
|
249
|
+
};
|
|
250
|
+
<>
|
|
251
|
+
<div style={styles} />
|
|
252
|
+
<svg {...{ style: styles }} />
|
|
253
|
+
</>
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const { body } = await render(Basic);
|
|
257
|
+
const { document } = parseHtml(body);
|
|
258
|
+
|
|
259
|
+
for (const element of document.querySelectorAll('div, svg')) {
|
|
260
|
+
expect(element.getAttribute('style')).toBe(
|
|
261
|
+
'margin: 0; opacity: 0; --literal: undefined; --literal-null: null;',
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
|
|
238
266
|
it('render tracked variable as style attribute', async () => {
|
|
239
267
|
function Basic() @{
|
|
240
268
|
const style = track({ color: 'red', fontWeight: 'bold' });
|
|
@@ -13,6 +13,29 @@ describe('basic client', () => {
|
|
|
13
13
|
expect(body).toBeHtml('<div>Hello World</div>');
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
it('keeps static text above U+00FF as character references', async () => {
|
|
17
|
+
function Basic() @{
|
|
18
|
+
const text = 'plain';
|
|
19
|
+
<>
|
|
20
|
+
<p title="a — b">
|
|
21
|
+
The Times — …
|
|
22
|
+
<b>»</b>
|
|
23
|
+
</p>
|
|
24
|
+
<span>{text}</span>
|
|
25
|
+
</>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { body } = await render(Basic);
|
|
29
|
+
|
|
30
|
+
expect(body).toBeHtml(
|
|
31
|
+
'<p title="a — b">The Times — …<b>»</b></p><span>plain</span>',
|
|
32
|
+
);
|
|
33
|
+
// A static em dash would otherwise widen the whole response to two bytes
|
|
34
|
+
// per character; the reference keeps it Latin-1.
|
|
35
|
+
expect(Buffer.byteLength(body, 'latin1')).toBe(body.length);
|
|
36
|
+
expect(Buffer.byteLength(body)).toBe(body.length + 1);
|
|
37
|
+
});
|
|
38
|
+
|
|
16
39
|
it('renders string interpolation as escaped text', async () => {
|
|
17
40
|
function Basic() @{
|
|
18
41
|
let markup = '<span>Not HTML</span>';
|