Re: JavaScript APIs organization

Le lundi 15 octobre 2012 à 10:31 +0100, Chris Mills a écrit :
> First of all, we need to make sure
> http://docs.webplatform.org/wiki/WPD:Content/Topic_Hierarchy works.
> Does this work for JS, and we just need to move the pages so they are
> consistently placed? Or could this use some updating? This is the
> definitive document that defines the IA for the site.

Thanks for that link, I hadn't stumbled upon it yet :)

I don't think the described hierarchy works for JavaScript stuff; I've
already mentioned DOM vs APIs, and the problems with name clashes if we
stuff all methods (resp. properties) in dom/methods (resp.
dom/properties) [I'll note that the table mentions using
dom/apis/methods, rather than "methods/" as a direct child of dom/].

Having "methods" and "properties" for Events in a separate hierarchy
might also be troublesome, since at the end of the day, events also have
DOM interfaces similar to other DOM interfaces.

The third hierarchy for "js" would probably make sense, but there again,
there is a risk of duplication/confusion if the rules of what go in JS
aren't crystal-clear. What is outlined in the proposed hierarchy seems
to make a strong link between the "js" subtree and the ECMAscript
language, which sounds good to me.

Here a few proposals on how this could be organized:
* js/language would have (roughly) the current proposed content of /js,
and js/global would have objects (à la navigator)/interfaces (à la
HTMLElement) available in the global scope in JavaScript; the dom/
subtree would disappear, and events/ would only keep the association
between events and events interfaces, not the detailed
properties/methods

* same as above, but js/ remains as is, dom/ becomes what I describe
above as js/global (although technically, navigator for instance isn't
part of the DOM)

I see that MDN uses the distinction js vs dom; instead of a URL
hierarchy (separated with /), they reuse the object hierarchy (separated
with dot) in the names. If anyone from MDN can comment on their
experience with approach, that would be useful input to the
discussion...

Dom

Received on Monday, 15 October 2012 09:54:28 UTC