Commit 97de564
authored
chore(xml-builder): single-pass XML escape for escapeElement and escapeAttribute (#7833)
Replace chained .replace() calls with a single regex + lookup map approach.
- escapeElement: 9 sequential .replace() calls → 1 pass with combined regex
- escapeAttribute: 4 sequential .replace() calls → 1 pass with combined regex
- Fix missing /g flag on \u2028 replacement in escapeElement (only first
occurrence was being escaped)1 parent 7f54759 commit 97de564
File tree
3 files changed
+29
-11
lines changed- packages-internal/xml-builder/src
3 files changed
+29
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
4 | 13 | | |
5 | 14 | | |
6 | 15 | | |
7 | | - | |
| 16 | + | |
8 | 17 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
1 | 15 | | |
2 | 16 | | |
3 | 17 | | |
4 | 18 | | |
5 | 19 | | |
6 | 20 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 21 | + | |
17 | 22 | | |
0 commit comments