HTML5 New API’s and Changed API’s

APIs

HTML5 has introduced many new APIs and have extended, changed or obsoleted some existing APIs.

5.1 New APIs

HTML5 introduces a number of APIs that help in creating Web applications. These can be used together with the new elements introduced for applications:

  • Media elements (video and audio) have APIs for controlling playback, syncronising multiple media elements, and timed text tracks (e.g. subtitles).
  • An API for form constraint validation (e.g. the setCustomValidity() method).
  • An API for commands that the user can invoke (used together with the command element among others).
  • An API that enables offline Web applications, with an application cache.
  • An API that allows a Web application to register itself for certain protocols or media types, using registerProtocolHandler() and registerContentHandler() .
  • Editing API in combination with a new global contenteditable attribute.
  • Drag & drop API in combination with a draggable attribute.
  • An API that exposes the components of the document’s URL and allows scripts to navigate, redirect and reload (the Location interface).
  • An API that exposes the session history and allows scripts to update the document’s URL without actually navigating, so that applications don’t need to abuse the fragment component for “Ajax-style” navigation (the History interface).
  • An API for base64 conversion (atob() and btoa() methods).
  • An API to schedule timer-based callbacks (setTimeout() and setInterval()).
  • An API to prompt the user (alert()confirm()prompt()showModalDialog()).
  • An API for printing the document (print()).
  • An API for handling search providers (AddSearchProvider() and IsSearchProviderInstalled()).
  • The Window object has been defined.

WHATWG HTML has further APIs that are not in HTML5 but are separate specifications at the W3C:

5.2 Changed APIs

The following features from DOM Level 2 HTML are changed in various ways:

Advertisements

HTML5 Changed Elements

Changed Elements

These elements have slightly modified meanings in HTML5 to better reflect how they are used on the Web or to make them more useful:

  • The address element is now scoped by the nearest ancestor article or body element.
  • The b element now represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede.
  • The cite element now solely represents the title of a work (e.g. a book, a paper, an essay, a poem, a score, a song, a script, a film, a TV show, a game, a sculpture, a painting, a theatre production, a play, an opera, a musical, an exhibition, a legal case report, etc). Specifically the example in HTML4 where it is used to mark up the name of a person is no longer considered conforming.
  • The dl element now represents an association list of name-value groups, and is no longer said to be appropriate for dialogue.
  • The hr element now represents a paragraph-level thematic break.
  • The i element now represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, or a ship name in Western texts.
  • For the label element the browser should no longer move focus from the label to the control unless such behavior is standard for the underlying platform user interface.
  • The menu element is redefined to be useful for toolbars and context menus.
  • The noscript element is no longer said to be rendered when the user agent doesn’t support a scripting language invoked by a script element earlier in the document.
  • The s element now represents contents that are no longer accurate or no longer relevant.
  • The script element can now be used for scripts or for custom data blocks.
  • The small element now represents side comments such as small print.
  • The strong element now represents importance rather than strong emphasis.
  • The u element now represents a span of text with an unarticulated, though explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in Chinese text (a Chinese proper name mark), or labeling the text as being misspelt.