-
Notifications
You must be signed in to change notification settings - Fork 142
JS docs: Have constructor pages instead of prototype pages #2571
Comments
Thanks for filing this issue @bershanskiy! I've updated the description a bit here to give more context. |
Hey @SphinxKnight, just a heads-up that this is happening. Some restructuring in the JS docs, see above. I hope it won't be too much of a hassle for locales. |
@Elchi3 Thanks a lot :) I've seen it coming, I don't think it is too painful and I (personnally) appreciate the distinction between constructors and types. Thanks again (and happy 2020 :)) |
The BCD updates are merged and should be on the site this Thursday. I'm going to leave a comment here with the list of pages again, but this time only listing those that I've refactored already and that are ready for review. Please tick the box if you've reviewed it and/or leave your feedback :-)
The following error type pages had prototype pages but no further sub pages. Instead they are referring to the pages of the main Error object. I've now merged the prototype page with the main page of these, but did not create constructor pages. I guess either we create sub pages for all things (methods, properties, constructors) or no sub pages at all. Let me know if you agree that dealing with this is out of scope for the moment, or not. (TypedArray types have the same thing, don't duplicate the whole API, which is quite large, under each type but instead refer to the generic TypedArray pages. An alternative organization would be that Float32Array lives in the TypedArray tree and is presented as one of many constructors. Same for Error and Error classes maybe.)
|
Thanks @sideshowbarker, that's because I haven't finished this task yet as it was quite difficult to focus on work last week. I hope I will finish this thing this week and then the 404s should be gone. |
The compat table at https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#Browser_compatibility lists "Promise() constructor" but it's not linked. I don't understand why. The data looks all right: https://github.com/mdn/browser-compat-data/blob/master/javascript/builtins/Promise.json#L55-L58. |
The opening para of https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/SharedArrayBuffer looks like it needs to be updated to be talking about the constructor rather than the object. It goes:
...where I would have expected something like:
|
A motivation for this issue is to be clear which sorts of objects different pages describe: in particular to split pages that describe objects and pages that describe constructors. So from this perspective, one question seems to be: what sorts of things do pages like They seem to describe So that makes it look like it is worth having separate, new, "constructor" pages for these
I don't think we need subpages for all the methods and properties. For one thing, from the structured content point of view it's fine for docs to be incomplete. For another, most of them seem to be just derived from the base Anyway. That's just my opinion, and maybe I misunderstand it :). |
@Elchi3 , I looked through all the pages referenced under #2571 (comment), checking things like BCD, whether "object" pages have a "Constructor" H2, whether the content looks sensible and whether the links work properly, and it generally looks great. I made a few comments above. |
FYI, today I created new constructor pages for
I hope I got it right, as far as the separation between those pages and the pages for their objects. I’m happy to help with getting new constructor separated out for other objects. I just did these two today because they are two specific ones that I’ve run into some particular annoyances with. |
I've noticed this too earlier this week and corrected it in a follow-up PR that made it into yesterday's BCD release, but apparently that release was not pushed prod yet.
Thanks, corrected.
No, just oversight from my part. I think once we start linting content against recipes we will have to pay attention to sections more carefully.
Yes, thanks for elaborating this some more. I think you are right in fact. I will look into creating constructor pages for error objects. It makes sense when looking at this from the content type perspective. |
@wbamberg thank you very much for your review! I've done some corrections and also finished String. Remaining are the error constructors and WebAssembly and Intl. For WebAssembly and Intl we have "namespaces" and there is a proposed reorg of this content (#2537). I think "namespace" might be a new content type and the reorg should probably be split out from the constructor work. So, I think, I will go ahead like @sideshowbarker did with PluralRules and RelativeTimeFormat and then we need to talk about how to reorg this with namespaces in mind (a new task in a new sprint). |
Also, I just realized, if we create constructor pages for the error objects, we would also need to create constructor pages for typed arrays. So make https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array about the object and have a separate page for the constructor there as well. |
Thanks @Elchi3 , I've verified that these three points are fixed, and checked off the corresponding items in #2571 (comment) 👍 |
Another thing before I forget this: Some compat data is about the constructor but currently lives under the object. See, e.g.
It should be moved. |
To do list for remaining constructor work: TypedArrays:
Errors: WebAssembly:
Intl: |
This took longer than I thought, but I think it is all done now. |
In #2537 @wbamberg and @Elchi3 proposed to completely separate object constructors (that are callable with
new
keyword) from the objects they construct. This is a meta issue to track which pages still need to be separated and updated.Update (by @Elchi3): This was actually discussed in London at the stumptown work week. The JS docs should follow the API docs and have pages for constructors instead of pages for prototypes. The prototype pages are mostly useless (and introduce weird usage of the page macro). Having pages for constructors instead seems more useful and consistent with API docs.
An update to BCD is also needed, see e.g. mdn/browser-compat-data#5440.
Pages (might not be complete)
The text was updated successfully, but these errors were encountered: