Commit b16c69a
feat: support HTML entities in JSX text/attributes
JSX text and attributes support HTML character references (a.k.a.
entities), and don't support ECMAScript string escape sequences.
Although the [spec] calls it "historical" and threatens to change it,
it _is_ in the spec, and the spec is pretty stable at this point.
In changing this, I landed back on an idea that @maxbrunsfeld suggested
in a [PR review] some time ago: having separate `string` and
`jsx_string` nodes, and aliasing `jsx_string` to `string` for consumers'
convenience. At that time, having two different node types was deemed
unnecessary, but this adds a second, more substantive difference between
the two, so I've brought the idea back, and stopped allowing invalid
newlines in JS string literals, which is invalid in both JS and TS.
[spec]: https://facebook.github.io/jsx/#sec-jsx-string-characters
[PR review]: #140 (comment)1 parent c2c2260 commit b16c69a
2 files changed
+72
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
| 610 | + | |
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
614 | 619 | | |
615 | 620 | | |
616 | 621 | | |
| |||
623 | 628 | | |
624 | 629 | | |
625 | 630 | | |
| 631 | + | |
626 | 632 | | |
627 | 633 | | |
628 | 634 | | |
| |||
682 | 688 | | |
683 | 689 | | |
684 | 690 | | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
685 | 719 | | |
686 | | - | |
| 720 | + | |
687 | 721 | | |
688 | 722 | | |
689 | 723 | | |
| |||
909 | 943 | | |
910 | 944 | | |
911 | 945 | | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | 946 | | |
919 | 947 | | |
920 | 948 | | |
| |||
938 | 966 | | |
939 | 967 | | |
940 | 968 | | |
941 | | - | |
| 969 | + | |
942 | 970 | | |
943 | 971 | | |
944 | | - | |
| 972 | + | |
945 | 973 | | |
946 | 974 | | |
947 | 975 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 111 | | |
128 | 112 | | |
129 | 113 | | |
| |||
151 | 135 | | |
152 | 136 | | |
153 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
0 commit comments