Commit 41a66ed
authored
fix(security): promote unknown bare elements for element bindings (#490)
Upstream routes element bindings through `calcPossibleSecurityContexts`
(`binding_parser.ts`), which promotes a bare element missing from the DOM
schema to its `:svg:`/`:math:` form — the same promotion our host-binding
path already applies for selectors. Our element-binding path looked up the
verbatim name, so `<animate [attr.to]>` missed `:svg:animate|to` and emitted
no `ɵɵvalidateAttribute`.
`security_context` now shares `collect_namespaced_contexts` /
`collect_bare_contexts` via `element_security_context_for`, which keeps the
numerically lowest context — matching upstream's `securityContexts[0]` after
its enum sort. That preserves `NONE` for `tagName === null` selectorless
hosts, which expand over every known element upstream.
Upstream quirks preserved:
- Promotion exists only alongside the namespaced schema (19.2.23 / 20.3.22 /
21.2.14 / v22). On earlier versions the whole selector goes through
`CssSelector.parse` verbatim, so `:svg:animate` still parses to element
`animate` and hits the bare `animate|to` key — `<svg><animate [attr.to]>`
keeps `ɵɵvalidateAttribute` at 21.2.7.
- `:xml:iframe` on pre-namespaced versions likewise parses to `iframe` and
hits `iframe|src`; only namespaced versions split the prefix, and only
normalizer versions (19.2.23 / 20.3.22 / 21.2.15+) strip it back —
21.2.14 alone misses, matching upstream.1 parent 0baf86c commit 41a66ed
4 files changed
Lines changed: 134 additions & 14 deletions
File tree
- crates/oxc_angular_compiler
- src
- schema
- transform
- tests
Lines changed: 80 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
871 | 871 | | |
872 | 872 | | |
873 | 873 | | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
874 | 901 | | |
875 | 902 | | |
876 | 903 | | |
| |||
916 | 943 | | |
917 | 944 | | |
918 | 945 | | |
919 | | - | |
920 | | - | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
921 | 952 | | |
922 | 953 | | |
923 | 954 | | |
| |||
1232 | 1263 | | |
1233 | 1264 | | |
1234 | 1265 | | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
1235 | 1313 | | |
1236 | 1314 | | |
1237 | 1315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| |||
5324 | 5328 | | |
5325 | 5329 | | |
5326 | 5330 | | |
5327 | | - | |
| 5331 | + | |
| 5332 | + | |
| 5333 | + | |
| 5334 | + | |
5328 | 5335 | | |
5329 | 5336 | | |
5330 | 5337 | | |
5331 | 5338 | | |
5332 | 5339 | | |
5333 | 5340 | | |
5334 | 5341 | | |
5335 | | - | |
| 5342 | + | |
| 5343 | + | |
| 5344 | + | |
5336 | 5345 | | |
5337 | 5346 | | |
5338 | 5347 | | |
| |||
5625 | 5634 | | |
5626 | 5635 | | |
5627 | 5636 | | |
5628 | | - | |
5629 | | - | |
5630 | | - | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
| 5642 | + | |
5631 | 5643 | | |
5632 | | - | |
| 5644 | + | |
5633 | 5645 | | |
5634 | 5646 | | |
5635 | | - | |
| 5647 | + | |
5636 | 5648 | | |
5637 | | - | |
| 5649 | + | |
5638 | 5650 | | |
5639 | 5651 | | |
5640 | 5652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10963 | 10963 | | |
10964 | 10964 | | |
10965 | 10965 | | |
| 10966 | + | |
| 10967 | + | |
| 10968 | + | |
| 10969 | + | |
| 10970 | + | |
| 10971 | + | |
| 10972 | + | |
| 10973 | + | |
| 10974 | + | |
| 10975 | + | |
| 10976 | + | |
| 10977 | + | |
| 10978 | + | |
| 10979 | + | |
| 10980 | + | |
| 10981 | + | |
| 10982 | + | |
| 10983 | + | |
| 10984 | + | |
| 10985 | + | |
| 10986 | + | |
| 10987 | + | |
| 10988 | + | |
| 10989 | + | |
| 10990 | + | |
| 10991 | + | |
| 10992 | + | |
| 10993 | + | |
| 10994 | + | |
| 10995 | + | |
10966 | 10996 | | |
10967 | 10997 | | |
10968 | 10998 | | |
| |||
0 commit comments