最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - Machine-readable (WebIDL) reference for JavaScriptHTML5? - Stack Overflow

programmeradmin0浏览0评论

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. / 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?

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?

Share Improve this question edited Sep 23, 2011 at 15:32 Eric Grange asked Sep 23, 2011 at 10:35 Eric GrangeEric Grange 6,2113 gold badges43 silver badges64 bronze badges 2
  • 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 Commented Feb 14, 2012 at 2:53
  • The esidl WebIDL to C++ compiler has a compilation of IDL files. There is also a scraper. – Janus Troelsen Commented Nov 3, 2012 at 14:33
Add a comment  | 

6 Answers 6

Reset to default 3 +50

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.

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

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.

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

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

See below link:

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

发布评论

评论列表(0)

  1. 暂无评论