The Poor, Misunderstood InnerText (2015)
perfectionkills.com
perfectionkills.com
If you’re interested in getting the “text” of some DOM, you should know that none of the built-in browser APIs will get you what you want, and moreover you’re gonna want it to be extensible in some ways so that you can, for instance, replace img elements with some equivalent markup, or omit the rendering of off-screen parts of large documents via windowing/virtualization. At the end of the day, there is no canonical representation of some DOM as plain text.
1. https://html.spec.whatwg.org/multipage/dom.html#the-innertex...
I'm not sure why anyone would use `textContent` anymore. I think I had even forgotten that it exists.
Then on the front page of HN today there is an article about K&R and Unix, which lead to a rabbit hole of reading. Again, the thought process, the methodology, the amount of design and specification done before even beginning to build Unix.
Now compare this to the first big invention of the late 20th/early-21st century: the web browser. It was driven by a race to monopolize the internet and maximize profit, a war of standards, and the consequences of poor planning hurt us today.
`innerText` isn't just -another- quirk that wastes precious human memory, at a higher level it is also a testament to what I see is a decline in rigor among applied computer science that started in the 90's and has dominated: Hack. Ship. Patch later (maybe). Or to quote the anti-mantra: "move fast and break things."
I don't deny that it's frustrating to be stuck with poor choices, ones which cause confusion and make development difficult. However, I think that this method got more software in the hands of people sooner than the counterfactual high rigour world. There's definitely an argument to be made that there's an inflection point, where the rigourous method is slower up until some point where it becomes a better baseline, and from there software development accelerates and overtakes our current world. I think it's hard to be confident in that argument, though.
Read about how andreesen at uiuc would would get an email and just add the feature.