I've frequently needed to truncate text online, experimenting with various methods. Discovering Christian Heilmann's trimMiddle()
function was a breakthrough.
My enthusiasm led me to create a web component based on it. Considering the styling challenges associated with web components, I opted to build it without shadow DOM, and I'm satisfied with the outcome.
A working demo is available. However, I encountered difficulties implementing dynamic inner text updates. Test it out and determine if it meets your needs.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3