0

There many Web APIs that browsers are expected to provide, like XMLHttpRequest, fetch, etc. The HTML spec itself also has a dedicated chapter named Web Application APIs. It feels to me that all APIs are provided in JS.

However, I also read from another answer that at least the DOM spec allows for implementation in languages other than JS.

Hence my question: are these web API specs language agnostic, or JS-specific?

wlnirvana
  • 1,811
  • 20
  • 36
  • Not sure this can be answered. Ultimately, Web APIs all use ECMAScript values, but these can, of course, mostly be translated to other programming languages. It’s also hard to tell if such a question even makes sense, given that JS is the only scripting language used for web content, built into the browser (can WebGL Shader Language be ignored in this context?). – Sebastian Simon Apr 03 '21 at 06:15
  • Following the [`Promise` in the signature of fetch](https://fetch.spec.whatwg.org/#dom-global-fetch), I found this [Web IDL](https://heycam.github.io/webidl/) thing, which might be an attempt to define the web technology in an language-agnostic way. Although it explicitly states that "How interfaces described with Web IDL correspond to constructs within ECMAScript execution environments is also detailed in this document." – wlnirvana Apr 03 '21 at 06:39
  • @SebastianSimon "given that JS is the only scripting language used for web content" Is this also formally defined in the spec? – wlnirvana Apr 03 '21 at 06:40
  • Well, [the HTML living standard](https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type) requires that a ` – wlnirvana Apr 03 '21 at 06:57

0 Answers0