-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ES5/ESnext switcher on about page #467
Conversation
Ref: #431 |
Looks like a good approach 👍 |
Looks like a great idea ! Good work! I gladly volunteer to port all other existing doc pages to have the two versions if the help is needed. |
@@ -24,6 +26,22 @@ http.createServer((req, res) => { | |||
}); | |||
``` | |||
|
|||
ES5: | |||
|
|||
```javascript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be ```js (https://github.com/nodejs/docs/blob/master/STYLE-GUIDE.md bottom).
@benjamingr since frontend is not my forte, it's been too long since I kept track of what browsers support what, and I was putting this up as a POC initially, would you mind taking this over? The branch is in the repo so you can take it and do what you like with it until you're happy with it. |
@benjamingr, @rvagg also I had a quick look a while ago, and I think the API docs are using features like |
@benjamingr @rvagg @eljefedelrodeodeljefe According to Web Browser Market Share Trends, IE8 has only 1.1% users in total (2015-12). So I think it's time to say goodbye to IE8. |
@eljefedelrodeodeljefe I vote to disable support for any browsers under latest (since it's for developers). JavaScript developers don't use old browsers anyway. The only case I can think of that makes me sad here is developers stuck debugging things on computers with old IE (like IIS servers) and want to open the docs - that's not really that big of a deal though. @rvagg assuming this idea (switching between modern JS and ES5) gets accepted - I can gladly revamp the code base for it and as I said before add such examples for all code examples on the site docs. I just don't want to do a lot of work while we're not sure yet it'll be used (and the PoC does a good job at illustrating the usefulness). |
Thanks for testing this @xcatliu , lets say good bye to old ies 👍 |
@benjamingr Flexbox support starts with IE10 (buggy and prefixed), IE11 should be fine. |
Noting this here for future folks: the Docs WG resolution was not to apply this approach to all of the docs due to the maintenance burden of keeping up two examples for every existing example, and instead look for a better way to highlight confusing syntax (like backticks.) |
This is a proof of concept, my frontend JS is super-rusty so this will likely need a more skilled hand if we go with it. My styling skills also leave a lot to be desired. The purpose of this is for discussion and a possible way to address the growing concern and confusion about the increasing use of ES6+ in docs. Specifically being discussed here: nodejs/docs#55 (and perhaps elsewhere?).
Here's what my PR adds:
The markdown only needs to have
Modern JavaScript:
added before a code block, thenES5:
followed by a code block with ES5. The work of putting it together is done in the browser, if for some reason that can't be done the fall back just displays the two blocks with titles above them so it gracefully degrades. This approach could be used across all docs, API docs included.