Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: DOM to textContent, would you find it useful?  (Read 519 times)

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1052
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
DOM to textContent, would you find it useful?
« 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.
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.


  • Junior Member
  • *
  • Posts: 9
  • Karma: +0/-0
Re: DOM to textContent, would you find it useful?
« Reply #1 on: 23 Oct 2021, 04:59:03 pm »
Hi Jason,

We cannot have one without the other.
There will be times where you want the plain text and other times you will want the raw text.

So maybe Element.__text and Element.__rawText?

I know this is uber delayed response but hope it helps.


SMF spam blocked by CleanTalk