-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
[Markdown] Remove inline styles from JS reference #4118
Conversation
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.
Looks good to me, Will! Great work! Not sure what to think about the remaining one but I guess we will come back to it anyways when we look at how we want to do tables in GFM.
Nice work — it looks really great. I think what you came up with is a very big improvement in the usability of that content.
Inspired by your work on the table in the “Enumerability and ownership of properties” article, I took a shot at re-working the nearly-as-ugly table in the “Loose equality using ==” section in the “Equality comparisons and sameness” article. The result is in #4133. (And in re-working the table, I took the opportunity to fix some other fairly fundamental problems with the content). I didn’t touch the other table in that article — the one in the “A model for understanding equality comparisons?” section — which uses inline styles to color some of the cells with a green background, and other red. But I think we could just drop the style attributes from that table altogether. The green/red background stuff is nice, but it’s not essential. |
So I figured out a way to preserve some green/red indicators without needing CSS — which is, instead use the ✅ and ❌ emoji characters. So I opened #4151 with a patch that drops the inline styles and replaces them with those emoji. |
This PR is intended to remove all uses of the
style
attribute from the JS docs (with one exception).According to my script, these are all the files in the JS docs that use the
style
attribute:https://github.com/mdn/content/tree/main/files/en-us/web/javascript/enumerability_and_ownership_of_properties/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/equality_comparisons_and_sameness/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/eventloop/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/guide/details_of_the_object_model/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/reference/global_objects/function/apply/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/reference/global_objects/math/cos/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/reference/global_objects/math/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/reference/global_objects/math/log1p/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html
https://github.com/mdn/content/tree/main/files/en-us/web/javascript/typed_arrays/index.html
In most cases just removing the style seemed to have no effect or didn't make the pages any worse.
In one case (the long note inside https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply#using_apply_to_chain_constructors) I just removed the whole note, as it said "The Object.create() method used above is relatively new...." which I don't think is true any more.
The most involved case was https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties, which uses inline styles to stop the layout from breaking when you have huge tables. I've reorganized and broken up the tables to avoid this (and I think the result is much clearer although I still find this page a bit baffling). I hope I didn't introduce any errors here, it's a bit intricate.
The case I didn't address was https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness. One excuse is that the styles are all inside tables, and I expect that we will keep at least some tables in HTML even when we are in Markdown, so we don't need to fix them now. But perhaps I should try to attack it anyway, inline styles are not a good idea anyway.