Live data from Hacker News

A guide to understanding HTML APIs

codecoda.com

1–9 of 9 posts

Re: A guide to understanding HTML APIs

#5

How can HTML have APIs if it’s not a programming language?

It's at the top of the article, and also the correct explanation of such:

  In an HTML API, the definitions and protocols are in the HTML itself, and the tools look in 
  HTML for the configuration. HTML APIs usually consist of a certain class and attribute patterns 
  that can be used on existing HTML.
HTML is just markup. You're familiar with markup if you've ever used a hilighter for instance. To make it an API just have something parse that markup according to some well-defined set of rules and to do _stuff_.

I can write a parser that accepts a single API call as it were:

  Smith

Now I can feed that into the parser and in this API of mine a `p` tag with attribute `data-do-a-thing` renders the contents of the tag prefixed with `Hello, ` giving `Hello, Smith`. Viola an API via HTML.

Re: A guide to understanding HTML APIs

#6
The article claims that:

> Canvas 2D Context API – This API allows users to draw in browsers. However, on the WHATWG living standard, it is mentioned that this API is no longer being actively maintained.

I can't find any such mention in the WHATWG canvas page[1]. Is the article correct in its claim?

[1] https://html.spec.whatwg.org/multipage/canvas.html

Re: A guide to understanding HTML APIs

#8
post #6

The article claims that: > Canvas 2D Context API – This API allows users to draw in browsers. However, on the WHATWG living standard, it is mentioned that this API is no longer being actively maintained. I can't find any such mention in the WHATWG canvas page[1]. Is the article correct in its claim? [1] https://html.spec.whatwg.org/multipage/canvas.html

Yeah that can’t be right. [There’s also the w3c version of the spec](https://www.w3.org/TR/2dcontext/) but I don’t see anything about that there either.

The only thing that might be true is that it’s essentially a frozen feature set, with nothing new being planned, but again I don’t see a mention of that.

Re: A guide to understanding HTML APIs

#9
post #6

The article claims that: > Canvas 2D Context API – This API allows users to draw in browsers. However, on the WHATWG living standard, it is mentioned that this API is no longer being actively maintained. I can't find any such mention in the WHATWG canvas page[1]. Is the article correct in its claim? [1] https://html.spec.whatwg.org/multipage/canvas.html

Yeah that can’t be right. [There’s also the w3c version of the spec]( https://www.w3.org/TR/2dcontext/ ) but I don’t see anything about that there either. The only thing that might be true is that it’s essentially a frozen feature set, with nothing new being planned, but again I don’t see a mention of that.

MDN's CanvasRenderingContext2D page[1] suggests that there's a number of 'experimental technology' areas in the API - for instance the filter property[2] (which excites me: hand-coding a performant blur filter is a nightmare!) - which suggests the features are still under active development.

[1] - https://developer.mozilla.org/en-US/docs/Web/API/CanvasRende...

[2] - https://developer.mozilla.org/en-US/docs/Web/API/CanvasRende...