16

I'm looking for a machine-readable reference of JavaScript classes (members, methods, parameters...), especially related to the HTML5 standard (canvas, storage, etc.).

All I have found so far is the specs on the W3C site, which include a part of the specification, f.i. http://dev.w3.org/html5/2dcontext/ has in it the Web IDL for CanvasRenderingContext2D, and other pages have other portions.

But I must be blind as I couldn't find some global index/summary with all the valid IDLs sorted and classified by version/drafts/etc.

Anyone know where it can be found?

Eric Grange
  • 5,931
  • 1
  • 39
  • 61
  • It would be wonderful to have a definitive place for it. Since it does not seem to exist yet, maybe it would be reasonable to start a github/bitbucket project scraping sites like whatwg.org? I actually might start one soon, together with OCaml and F# parsers for WebIDL.. – t0yv0 Feb 14 '12 at 02:53
  • The esidl WebIDL to C++ compiler has **[a compilation of IDL files](http://code.google.com/p/es-operating-system/source/browse/trunk/esidl/dom/)**. There is also a scraper. – Janus Troelsen Nov 03 '12 at 14:33

6 Answers6

3

HTML5 is still changing, so any official reference bar the spec is almost inevitably going to be out of date.

Your best bet is to suck the data straight out of the spec. Parse the file and then extract all the pre elements with class idl. That's your machine readable list. Guaranteed official and up-to-date.

Alohci
  • 78,296
  • 16
  • 112
  • 156
  • 2
    Yes, the spec does change, it's a draft. But does the spec explicitly state that blind extraction of the IDL element is safe? There is no telling what human-language qualifiers could be in the spec's text around those IDL elements, as an extreme case would be an element annotated with wording like "this WebIDL draft is obsolete, don't rely on it". – Eric Grange Oct 03 '11 at 06:59
  • 1
    The typographic conventions section [1.7.2](http://dev.w3.org/html5/spec/introduction.html#typographic-conventions) says that for sections marked up as I indicate that "This is an IDL definition", not "this may be an IDL definition". I think that's as good as you're going to get. – Alohci Oct 03 '11 at 17:57
  • 2
    Be careful, though. It seems that even google has problems to parse IDLs: http://krijnhoetmer.nl/irc-logs/whatwg/20110618#l-287 – itorres Oct 03 '11 at 20:06
  • Got a reply from Ian Hickson, which confirms you, I'll post a summary in another reply, but I'm awarding you the bounty. – Eric Grange Oct 04 '11 at 07:03
  • 1
    You should check out [dom.js on github](https://github.com/andreasgal/dom.js) which is using [webidl on github](https://github.com/darobin/webidl.js) to parse out the [idl's for dom.js](https://github.com/andreasgal/dom.js/tree/master/src/idl). It's all pretty cool stuff. – dyork Jan 05 '12 at 07:08
2

Asked Ian Hickson (editor of the spec at the time of this answer), here is an edited summary of his reply:

There is not a single document that contains all the IDL fragments, no.

[so the HTML spec documents constitute the reference for WebIDL]

FWIW, I recommend using this source:

http://whatwg.org/c

It's more canonical than the W3C copies.

A blind extraction [of the <pre class="idl"> elements] should mostly work. It'll need a little massaging, but not much. Make sure to exclude the class="idl extract" blocks.

I actually do do a blind extraction as part of the spec generation process, to verify that the IDL syntax is correct (or rather, that all the mistakes are intentional... I occasionally use syntax that isn't specced in the WebIDL spec yet).

Eric Grange
  • 5,931
  • 1
  • 39
  • 61
1

Not sure if it is WebIDL, but the WebKit Source has lots .idl files mixed in with the .cpp and .h files. You can browse the source online. Start at WebCore and dig into some of the subdirectories.

Kevin Hakanson
  • 41,386
  • 23
  • 126
  • 155
  • Question, is, where do these come from? Where is the official source repository for those IDL, maintained by the W3C? Many of those IDLs are drafts, which means they can evolve, and manually collecting them is bound to be an error-prone process. – Eric Grange Oct 01 '11 at 20:00
  • 1
    Might be worth emailing Ian Hickson to ask. He is the editor of the W3C Working Draft you linked to (among others) and his email address is available on that document. – Kevin Hakanson Oct 01 '11 at 22:53
  • I've sent an email, I'll post the answer (if any) there. – Eric Grange Oct 03 '11 at 07:24
0

The WebIDLs used by Mozilla can be found at http://mxr.mozilla.org/mozilla-central/source/dom/webidl/

erikkallen
  • 33,800
  • 13
  • 85
  • 120
0

See below link:

Dependent Specifications: http://www.w3.org/wiki/Web_IDL#Dependent_Specifications

Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137
0

Are you looking for this? http://code.haskell.org/yc2js/W3C/

itorres
  • 359
  • 3
  • 10
  • Those look last updated Oct 2009. Also found an html5.idl at http://code.google.com/p/es-operating-system/source/browse/trunk/include/w3c/html5.idl?r=1669 – Kevin Hakanson Sep 30 '11 at 13:50
  • Yes, something like that, but from an official source, maintained & updated. I've seen other IDLs in other projects, but I haven't yet found the original reference source... – Eric Grange Oct 01 '11 at 19:57