Nonbreaking Whitespaces
Need to think through collapsing whitespace. 99% of the time, whitespace in the DOM should be collapsed/ignored, but perhaps with whitespace: true, ’s could be treated like characters & preserved for instances like this?

https://codepen.io/nexii/pen/VBVeMx/
I'm not sure how to do this without making significant changes to the splitText function. The splitOn expression is collapsing sibling spaces. Given that it results an empty string as one of the split results, we might be able to convert that to 3 whitespaces. Perhaps?
Does show up differently in the DOM than a regular space?
Yes, but we convert it regular spaces with "wholeText" I believe.
shshaw [12:20 PM] https://codepen.io/shshaw/pen/c01954047c28ad93e173be88dd88943f?editors=1010
shshaw [12:27 PM] Not sure why the original DOM node’s innerText is trimmed & cleaned up, whereas the testNode isn’t
notoriousb1t [12:27 PM] it is saying appendChild is not available? (edited)
shshaw [12:28 PM] Refresh
notoriousb1t [12:35 PM] https://stackoverflow.com/questions/1495822/replacing-nbsp-from-javascript-dom-text-node check this out non breaking space is a different char code than space (edited)
shshaw [12:36 PM] Hm, yeah.
notoriousb1t [12:36 PM] so we can swap that out for a delimiter or change the split pattern to exclude it
shshaw [12:45 PM] delimiter? Yeah, the split regex is definitely aggressive right now with all whitespace
/[\t\n\r ]+/may be a better approach? https://regexr.com/3ucq8/[\t\n\r\v\f ]+/gmAlternative:/[^ \S]+/gmmatch everything that’s NOT a nonbreaking space or NOT whitespace These would potentially group s with the closest non-whitespace separated word, though. (edited)notoriousb1t [1:02 PM] I was suggesting either to replace with a different character and then do a /\s+/ replace to " " or use /[\t\n\r ]+/ or similar I am not sure what \f and \v are specifically other whitespace characters?
shshaw [1:03 PM] Yeah “feed” and “vertical tab”
notoriousb1t [1:04 PM] oh
shshaw [1:04 PM] feed = different type of return vertical tab, no idea
notoriousb1t [1:04 PM] but doing a regex replace on wholeText that will give us the proper amount of spaces and then replacing "" in split results with a whitespace sounds like a good strategy
I'm encountering this issue right now. My users can add in their text at various places and the lettering effect breaks or jumps when there's a line break in the middle of an otherwise nbsp;.
Has this ever been solved by someone so that I can get inspiration to solve it on my end? 🤔 Maybe with a custom plugin?