host bindings: empty `[]` / `()` keys accepted, and `aria-*` host bindings stay DOM properties

Offen
#704 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
56/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
angular, rust
Bereich
compilers

Rechercherichtung

Start by reading binding_specialization.rs, especially is_aria_attribute and specialize_bindings_for_host, then trace where host binding keys are parsed and validated. Reproduce the empty [] and () cases and the host aria-* cases against the issue’s ngtsc examples. Done when empty keys produce missing-name errors and host aria-* bindings compile as attributes.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Found while reviewing #697. Checked against ngtsc 22.2.4.

1. Empty [] / () host keys are accepted

@Directive({ selector: '[d]', host: { '[]': 'a', '()': 'b()' } })
ngtsc   error NG5001: Property name is missing in binding / Event name is missing in binding
Oxc     no error; emits ɵɵlistener("", …) and ɵɵdomProperty("", ctx.a)

2. Host aria-* bindings stay DOM properties

@Directive({ selector: '[d]', host: { '[aria-label]': 'l' } })
export class D { l = 'a'; @HostBinding('aria-hidden') h = true; }
ngtsc   ɵɵattribute("aria-label", ctx.l)("aria-hidden", ctx.h)
Oxc     ɵɵdomProperty("aria-label", ctx.l)("aria-hidden", ctx.h)

binding_specialization.rs rewrites aria-* to an attribute only for templates (is_aria_attribute), not in specialize_bindings_for_host.

Vorherrschende Sprache
Rust
Sterne
245
Forks
26
Ø Merge
1 T. 23 Min.
Gemergte PRs (30 T.)
83

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus voidzero-dev/oxc-angular-compiler

Alle Issues in voidzero-dev/oxc-angular-compiler

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.