Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix textarea content rendered twice #130

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

jmerle
Copy link
Contributor

@jmerle jmerle commented Feb 5, 2025

Description

This PR fixes #50, i.e. content in textareas being rendered twice. This appears to be caused by copyInputValue copying the original textarea's value into the clone textarea's innerHTML, after which the cloneChildNodes call in src/clone-node.ts:223 appends clones of the textarea's child nodes to the same innerHTML. This effectively repeats what copyInputValue already did, resulting in the original content appearing twice in the clone. I fixed the issue by removing the copying that happens in copyInputValue.

Before:

After:

Additional context

The font rendering on my system is slightly different from the one used to generate the test fixture images, so I did not add a unit test because it'll likely fail on the system that was used to generate the existing fixtures.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@qq15725 qq15725 merged commit 30ae39d into qq15725:main Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

having issue with background clip in textarea
2 participants