bug: setting an ion-label's textContent early results in double labels

Offen
#30,749 2 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
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
typescript
Bereich
frontend

Rechercherichtung

Beginne mit der CodePen-Reproduktion und untersuche die Implementierung von ion-label sowie die Verarbeitung von textContent; verfolge anschließend alle daran beteiligten StencilJS-Patching-Vorgänge. Erledigt ist die Aufgabe, wenn das Zuweisen von textContent vor dem Anhängen und die erneute Zuweisung danach nur den neueren Label-Text zurücklässt, mit einem Regressionstest, der beide Zuweisungen abdeckt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

stencil type: bug
Prerequisites
Ionic Framework Version

v8.x

Current Behavior

When setting a new <ion-label> instance's textContent before it is attached to the document and then after attaching it re-assigning a new textContent value will leave both visible.

See: https://codepen.io/ErikOnBike/pen/XJXqZxR

Expected Behavior

The second assignment to the textContent property should remove the existing textContent value.

Steps to Reproduce

See: https://codepen.io/ErikOnBike/pen/XJXqZxR

Code Reproduction URL

https://codepen.io/ErikOnBike/pen/XJXqZxR

Ionic Info

n/a

Additional Information

This might be the effect of StencilJS' textContent patching. I'm not sure if I fully understand why StencilJS does all kinds of patching for WebComponents. It overrides things like children, childNodes and textContent which results in awkward behaviour if you're not following the standard Angular/Vite approach of dealing with DOM manipulation. I bumped into this a number of times now (I'm not using the mentioned frameworks).

Vorherrschende Sprache
TypeScript
Sterne
52.8k
Forks
13.3k
Ø Merge
3 T. 1 Std.
Gemergte PRs (30 T.)
86

Entwicklungsumgebung

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 ionic-team/ionic-framework

Alle Issues in ionic-team/ionic-framework

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

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