News for hackers. Stuff that matters.
Re:JavaScript growth and third parties by franga2000 on Friday December 14, 2018 @06:26AM (#18680080)
I'm a web developer who avoids this sad trend wherever possible. I see two reasons for this: 1) the development experience for things like React is so 'smooth' that many developers use it even when it's not necessary at all (I'm referring to things like hot-reloading and custom components which are more complicated to set up with pre-processors) 2) some animations and advanced interactivity have become expected of us, but instead of tacking it on later, which makes the code objectively less clean, they build everything in JS, making it perform like shit and leading to things like the infamous gray bars placeholder.

But it can be done right. dev.to is a great example of an interactive web application with all the bells and whistles, yet it still performs better than most static sites.

Re:JavaScript growth and third parties by azangru on Friday December 14, 2018 @06:38AM (#18680135)
An unrelated question: how many `html` and `body` tags are allowed on a web page? I just looked at the page source of https://dev.to/liquid_chickens/three-qualities-of-failed-mic..., and to my surprise noticed they have about five `html` and `body` tags on that page. They aren't even in iframes either.
Re:JavaScript growth and third parties by franga2000 on Saturday December 15, 2018 @02:24AM (#18687477)
One and only one of each. And having more than 1 doctype declaration is ridiculous. Browsers are very resistent to garbage markup, so by looking at the parsed tree and not the raw text, I never actually noticed that.

I have no idea why they would do that. It looks like a misconfigurated preprocessor that thinks each fragment is a doc of its own. I vaguely recall something about them open-sourcing the frontend, so I might look into that...

Re:JavaScript growth and third parties by azangru on Saturday December 15, 2018 @10:55AM (#18688827)
Yep, my guess would be that they are using a markdown parser that generates a complete html document out of submitted markdown, and then they just stitch those parsed htmls together, like here (the processed_html method on the article instance):

https://github.com/thepracticaldev/dev.to/blob/master/app/vi...

> Browsers are very resistent to garbage markup

Miraculously so! Anything I would have attempted to design would have crapped its pants at the look of this markup, but browsers heroically manage to display it as if nothing weird is happening. I take my hat off to their resilience.

Re:JavaScript growth and third parties by bhalp1 on Saturday December 15, 2018 @11:00AM (#18688867)
Yes. And actually, this is a mistake in our processing configuration. We don’t want separate body tags, but it hasn’t been a problem so we haven’t gotten around to fixing it.

PRs welcome. :)