Live data from Hacker News

Write HTML Like It's 1999

bradleytaunt.com

171–180 of 191 posts

Re: Write HTML Like It's 1999

#172
post #93

Earlier quoted context omitted.

> run arbitrary code on their machine That's a bit of an exaggeration. JavaScript is strongly sandboxed and has a pretty good permissions system. The only malicious things it can really do are 1) based on cookies or 2) crypto mining. Personally I think it's unreasonable to expect today's sites to work without JavaScript completely. The real benefits of using it sparingly are: - Pages load faster - Pages are more resp…

> JavaScript is strongly sandboxed and has a pretty good permissions system We now live in a post-Spectre world. I don't think a sandbox means all it meant in 2017.

Can you point to a single real-world example of Spectre being used in a browser attack?

Re: Write HTML Like It's 1999

#173
post #82

Really almost all of this comes down to, "don't use JavaScript to replace HTML". Everything else on this post derives from that one guideline. For example, "Implementing custom div layouts for forms while removing items like select or radio" is only possible if you're replacing native functionality with JavaScript. Which is perfectly fine advice if you aren't doing anything really novel. You probably don't need a cus…

> Content being heavily reliant on JavaScript “injection” Salient point right here. Being served a blank white page (when JS is disabled) can deter a person from ever visiting a site again. Some peope out there want to vet a site before allowing it to run arbitrary code on their machine.

Hence the move toward static site frameworks like react static and gatsby

Re: Write HTML Like It's 1999

#174
post #147

While I agree that semantic HTML is a nice thing, I am also confused because the HTML I saw in 1999 didn't look like what the author suggests. If I am not completely mistaken, nav is an HTML5 element that didn't even exist back then. Instead, we used tables inside tables insides tables inside iframes to structure our navigations. CSS was still some mystic magic that only a few wizards knew how to use effectively. And…

I think clearly author was using "like it's 1999" as a metaphor, not literally. It's a fairly common phrase (originating from a Prince song I think) that you can take to mean "like a throwback to a more authentic and possibly prior era." In this case the era is prior the explosion of frameworks and div soup. Which strangely in this case is not necessarily prior but in parallel, as you said. This is English, it doesn'…

Funny enough, that song is from 1982. It's looking forward towards the end of the world on 2000-01-01, and to "party like it's 1999".

Re: Write HTML Like It's 1999

#175

Was I the only one who clicked this expecting React components for modern CSS layouts using markup like and Last Updated: June 1999 Otherwise you’re not writing HTML like it’s 1999, you’re writing HTML like it’s the web standards movement of the early 2000s before AJAX and Web 2.0 started trending. If you really want to write HTML like it’s from 1999, read this blast from the past: https://www.w3.org/TR/2018/SPSD-htm…

While the spacer.gif made me really nostalgic, this is one of the things I don't miss. However, layoutwise HTML is at the moment much like it had been in 1999: The basic structure with banner, nav, main, footer is much like the standard frameset, if there had only been role/landmark-markup for frames, and CSS-grid in its basic form is much like table-layout (less those Daliesque "poles" for positioning). Where there…

> However, JS is "a bit" more powerful and has grown out of `document.write()`

Wasn't innerHTML still settable back then?

Re: Write HTML Like It's 1999

#176
post #138

As someone who has a pretty serious visual impairment, I find the attitude of so many of these comments really... disappointing. You wouldn't believe how much effort people with poor vision have to go to, to consume the modern web. You can't even take simple things for granted like being able to zoom. So many websites pollute their page with pointless navigation elements that block most of the content when the page i…

I wouldn't have any issue justifying spending reasonable time making webpages as accessible as possible (even with image replacement text, blind people are going to miss some of the info in the image), but I miss exact guides as to what that means. At present I can throw in some Aria tags, but I don't know when that is needed (can webreaders figure out that means an article?) and I don't know when that is enough.

I am also not in the US, so I can't tell my boss to spend disproportionate amount of dev time on something that doesn't make money.

Re: Write HTML Like It's 1999

#177
post #93

Earlier quoted context omitted.

> Content being heavily reliant on JavaScript “injection” Salient point right here. Being served a blank white page (when JS is disabled) can deter a person from ever visiting a site again. Some peope out there want to vet a site before allowing it to run arbitrary code on their machine.

> run arbitrary code on their machine That's a bit of an exaggeration. JavaScript is strongly sandboxed and has a pretty good permissions system. The only malicious things it can really do are 1) based on cookies or 2) crypto mining. Personally I think it's unreasonable to expect today's sites to work without JavaScript completely. The real benefits of using it sparingly are: - Pages load faster - Pages are more resp…

I am split: web pages can be enhanced with JS, but webpage mostly shouldn't need them (exception: some data visualization does benefit from being able to dynamically change values).

Web apps on the other hand, probably do need them. I use newsblur and definitely enjoy the shortcuts.

Re: Write HTML Like It's 1999

#178

Earlier quoted context omitted.

Why not inject css instead? That would be more effective

how do you mean?

Like this: https://stackoverflow.com/questions/15505225/inject-css-styl...

  var node = document.createElement('style');
  node.innerHTML = '* { outline: 2px dotted orangered; };
  document.body.appendChild(node);

Re: Write HTML Like It's 1999

#179
post #106
post #82

Really almost all of this comes down to, "don't use JavaScript to replace HTML". Everything else on this post derives from that one guideline. For example, "Implementing custom div layouts for forms while removing items like select or radio" is only possible if you're replacing native functionality with JavaScript. Which is perfectly fine advice if you aren't doing anything really novel. You probably don't need a cus…

> The one part I disagree with is necessarily using in place of divs with CSS Grid. I suppose the soundness depends on how you read the word "table". For actual tabular data, is probably the right choice for accessibility reasons. It's also why it's usually a bad idea to abuse tables for grid layouts in other cases.

CSS Grid is intended to be a wholesale upgrade from . Do screen readers actually factor in the semantics of table markup?

> It's also why it's usually a bad idea to abuse tables for grid layouts in other cases.

This isn't so much about semantics, it's about the way it kills responsiveness

Re: Write HTML Like It's 1999

#180
post #178

Earlier quoted context omitted.

how do you mean?

Like this: https://stackoverflow.com/questions/15505225/inject-css-styl... var node = document.createElement('style'); node.innerHTML = '* { outline: 2px dotted orangered; }; document.body.appendChild(node);

This should suffice, no need to make a variable, this can all be done at once:

   document.head.appendChild(document.createElement('style')).textContent = '* { outline: 2px dotted orangered'
Post reply on HN