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(components): [input] unify async-validator string length calc #16757

Merged
merged 1 commit into from May 20, 2024

Conversation

btea
Copy link
Collaborator

@btea btea commented May 6, 2024

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

fix #16756

The internal string length calculation method of async-validator is inconsistent with input. In order to keep the results consistent, the calculation methods of the two are unified.

Since async-validator has not been updated for two years, the fastest, most efficient and controllable way is to generate patch file modifications, so I made this modification.

Copy link

github-actions bot commented May 6, 2024

@github-actions github-actions bot added the CommitMessage::Qualified Qualified commit message label May 6, 2024
Copy link

github-actions bot commented May 6, 2024

🧪 Playground Preview: https://element-plus.run/?pr=16757
Please comment the example via this playground if needed.

@btea btea changed the title fix(components): [input] unify async-validator character length calc fix(components): [input] unify async-validator string length calc May 6, 2024
@makedopamine
Copy link
Contributor

Question: Why do you choose the length property which counts the length of a string in UTF-16 code units? Why not count the length in code points?

@btea
Copy link
Collaborator Author

btea commented May 10, 2024

Follow the calculation method of the tag's native maxlength attribute.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#maxlength

@makedopamine
Copy link
Contributor

Follow the calculation method of the tag's native maxlength attribute. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#maxlength

Well, that makes sense.

Copy link
Member

@plainheart plainheart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref: #6588 #6127

@btea btea requested a review from kooriookami May 18, 2024 05:11
@btea
Copy link
Collaborator Author

btea commented May 20, 2024

@kooriookami I think the spelling errors in the original comments may not need to be corrected. 😀

@btea btea merged commit b1bfb9f into dev May 20, 2024
10 checks passed
@btea btea deleted the feat/unified-async-validator-string-length-calc branch May 20, 2024 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CommitMessage::Qualified Qualified commit message
Projects
None yet
4 participants