1.0.2 • Published 1 year ago
@annoyingmouse/wc-trim-middle v1.0.2
Shamelessly stolen from Christian Heilmann this takes his function and embeds it into a Web Component without a shadowDOM, according to Mr Heilmann:
The original text is retained in the title attribute of the element, but only if the string has been trimmed.
Usage
<span is="wc-trim-middle">This is a long string that will be trimmed</span>
<script type="module" src="wc-trim-middle.js"></script>Configuration
- Adding a
widthattribute allow you to define the amount of letters you want to show - it defaults to 16. - Adding a
replacementattribute allows you to change what the character in between the parts should be - it defaults to….
License
MIT