5 ms·
Minor, but instead of: status.setAttribute('style', 'display:none'); I would suggest just writing: status.style.display = "none"; (and similarly for
by czr 7y ago
Minor, but instead of:
status.setAttribute('style', 'display:none');
I would suggest just writing:
status.style.display = "none";
(and similarly for the other DOM modifications; see [0] for a discussion of setAttribute vs property syntax)
[0] https://stackoverflow.com/questions/3919291/when-to-use-setattribute-vs-attribute-in-javascript https://stackoverflow.com/questions/3919291/when-to-use-seta...
- mileycyrusXOXO 7y agoThanks, that is much cleaner. I'll spend some time tomorrow cleaning up the code.
- runarberg 7y agoI would recommend against using CSS to hide this information at all since a user might have both CSS and JavaScript disabled. In fact I would have used JS to manipulate all elements conveying the relevant information.
- mileycyrusXOXO 7y agoYou are correct, I am going to fix this. There is comment below where someone has a screenshot of how it looks in lynx, where CSS and JS don't exist. Instead of using CSS to swap visibility I am going to revert to how I initially had it where JS changes the text from 'disabled' to 'enabled'. Edit: Fixed it, thank you.
- runarberg 7y ago<nitpick> I would also recommend against using the `<h1>` tag to convey the main information. Usually `<h1>` is used for the main heading—which I presume is the text ”is js enabled” which is located at the top, but wrapped inside a `<nav>`instead of a `<header>` to denote the document structor and `<h1>` to denote the text’s purpose as a main heading. Instead I would use a `<strong>` tag to convey the main information, and a nested `<b>` (the Bring attention to element) to spell the word “enabled” or ”disabled” </nitpick>
- SquareWheel 7y agoDefinitely not just a nitpick. Proper header use is important for accessibility trees and robots.
- mileycyrusXOXO 7y agoAppreciated, I took the time to make these changes this morning.
- SquareWheel 7y agoIf a user turns off CSS then virtually no websites will render correctly for them. Adding a specific detection for that fail state is really just unnecessary bloat.
- dvfjsdhgfv 7y agoYou're kidding, right? Turning off CSS is used together with turning of CSS and images to improve the legibility of some websites. For example, using Medium with everything on is a pain. But if you switch off JS, CSS and images, very often the whole text of an article fills in one screen, is quite clean and really fast. Using Medium in this way actually becomes a pleasure (unless the images are a apart of the article) - you can navigate the website rarely using the mouse. In any case, I'm not alone in using the web in this way - turning everything on is just a waste of time and resources. You can check it easily yourself with an extension like disable-HTML that allows turning off these thing instantly.
- SquareWheel 7y agoHere is how Medium looks without CSS: https://i.imgur.com/MAalREE.png https://i.imgur.com/MAalREE.png If you find that more legible then all power to you, but nobody browses like that.
- dvfjsdhgfv 7y agoYou forgot to turn off the images. When you do, you'll see how readable and blazing fast the website is.
- flukus 7y agoThat appears to be the index page rather than the article and is not too bad. But that's just the default browser layout, sites usually look a lot better in reader mode. Also, with js disabled your link is just an empty page, imgur is too incompetent to be able to show images without JS.
- 7y ago