Fix textarea content rendered twice #130
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes #50, i.e. content in textareas being rendered twice. This appears to be caused by
copyInputValue
copying the original textarea'svalue
into the clone textarea'sinnerHTML
, after which thecloneChildNodes
call insrc/clone-node.ts:223
appends clones of the textarea's child nodes to the sameinnerHTML
. This effectively repeats whatcopyInputValue
already did, resulting in the original content appearing twice in the clone. I fixed the issue by removing the copying that happens incopyInputValue
.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?
Before submitting the PR, please make sure you do the following
fixes #123
).