ionic-team / ionic-team/ionic-framework

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

未关闭
#30,749 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
stencil type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

### Prerequisites

- [x] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [x] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [x] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v8.x

### Current Behavior

When setting a new `` 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).

贡献指南

打开贡献指南

调研方向

Start with the CodePen reproduction and inspect the ion-label implementation and its textContent handling, then trace any StencilJS patching involved. Done means assigning textContent before attachment and reassigning it afterward leaves only the newer label text, with a regression test covering both assignments.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。