CutCodeDown

Web Development => JavaScript => Topic started by: Jason Knight on 7 Jul 2021, 11:47:17 am

Title: DOM to textContent, would you find it useful?
Post by: Jason Knight on 7 Jul 2021, 11:47:17 am
Because textContent and innerText are utterly unreliable and output the result willy-nilly cross-browser, I've got my own Element.__text method for the upcoming Elementals 5 that outputs a whitespace condensed and trimmed version of the textcontent of an element. Aka it's exactly how a browser would render non-preformatted text.

But I was thinking on making a more robust version more akin to innerText where block-level tags still get /r/n at the end of their content nodes, and maybe preserving UL/OL bullets...

At which point, I could probably make it parse to AND FROM markdown. So my question is would anyone find that useful enough to put it into the baseline library? It would probably end up another 3-4k of code, and I'm already butting heads with my hard-limit of 24k. (16.7k right now, gzipped around 6k)

This is funny, I hate markdown, but it would be a nice tribute to Aaron. We went round and round in circles arguing the pro's and cons of it. He'd be shocked to hear me coming around on the topic.