-
Notifications
You must be signed in to change notification settings - Fork 515
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
JSRef doesn't work well with certain language features #3826
Comments
@wbamberg What is your opinion on this nowadays?
|
This issue was mostly prompted by things like Another is (as the issue says) to make much bigger changes to the JS sidebar. I like having a single sidebar for a domain if possible, because it gives a much more consistent experience when navigating around. We now have single sidebars for CSS and for HTML (since #7402 ). Now we have auto-scrolling sidebars I think these kinds of sidebars work better, although we could certainly improve the CSS one with some design work. I also expect that @Josh-Cena has views on this though so we should ask him. |
Jumping in, but I really don't have great ideas about the sidebars work.
Strongly agree. See also: mdn/content#20019. Objects that have actual inheritance are not displayed as such at all: typed arrays, errors, etc.
|
Background
{{JSRef}}
is the macro we use to generate a sidebar for JS global objects and their members, like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then.(For other bits of JS, including the guide pages, high-level pages, and things like statements or operators, we use
{{JsSidebar}}
, a different macro that generates a different sidebar, as in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of .)Problem
JSRef
assumes that the thing it's a sidebar for is living directly underneath /Web/JavaScript/Reference/Global_Objects, and that its properties, methods, and constructor live directly underneath it. For example:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
This assumption breaks down for JS objects that live in a kind of namespace, like
Intl
,WebAssembly
, and nowTemporal
.These have a three-level hirarchy, with the namespace (currently) under /Web/JavaScript/Reference/Global_Objects, then static members and the objects in that namespace under that, then members of those objects at a third level:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory/grow
...and
JSRef
isn't really able to represent this at all.Current workaround
We work around this by manually adding the objects to the "related pages" item for that namespace, but it's far from ideal.
Solution
Fixing this would take some careful thought about how we want to represent these things. Sidebar design is tricky. Perhaps we don't want to have them under "Global_Objects" at all? It seems a bit of a stretch to call
Intl
an object when you can't instantiate it. Should we have "Namespaces" at the same level as "Global_Objects"?In general I do think it would be worth using this as an opportunity to revisit the JS sidebars as a whole. There are a few other things we might consider:
JSRef
show inheritance (usuallyObject
and oftenFunction
) and list all inherited members of the objects they inherit from. It's been suggested that these aren't very useful.Note that we talked about a new JS sidebar a lot in the old stumptown work, and some of that might be reusable here: mdn/stumptown-content#302 (comment).
The text was updated successfully, but these errors were encountered: