Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Machine-readable (WebIDL) reference for JavaScript / HTML5?

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?

like image 357
Eric Grange Avatar asked Sep 23 '11 10:09

Eric Grange


3 Answers

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.

like image 57
Alohci Avatar answered Oct 20 '22 01:10

Alohci


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).

like image 2
Eric Grange Avatar answered Oct 20 '22 01:10

Eric Grange


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.

like image 1
Kevin Hakanson Avatar answered Oct 20 '22 01:10

Kevin Hakanson