September 24, 2010

API's In HTML 5.......ShYaM

HTML5 introduces a number of APIs that help in creating Web applications. These can be used together with the new elements introduced for applications:
  • API for playing of video and audio which can be used with the new video and audio elements.
  • An API that enables offline Web applications.
  • An API that allows a Web application to register itself for certain protocols or media types.
  • Editing API in combination with a new global contenteditable attribute.
  • Drag & drop API in combination with a draggable attribute.
  • API that exposes the history and allows pages to add to it to prevent breaking the back button. 

    Extensions to HTMLDocument

    HTML5 has extended the HTMLDocument interface from DOM Level 2 HTML in a number of ways. The interface is now implemented on all objects implementing the Document interface so it stays meaningful in a compound document context. It also has several noteworthy new members:
  • getElementsByClassName() to select elements by their class name. The way this method is defined will allow it to work for any content with class attributes and a Document object such as SVG and MathML.
  • innerHTML as an easy way to parse and serialize an HTML or XML document. This attribute was previously only available on HTMLElement in Web browsers and not part of any standard.
  • activeElement and hasFocus to determine which element is currently focused and whether the Document has focus respectively.
  • getSelection() which returns an object that represents the current selection(s).

    Extensions to HTMLElement

    The HTMLElement interface has also gained several extensions in HTML5:
  • getElementsByClassName() which is basically a scoped version of the one found on HTMLDocument.
  • innerHTML as found in Web browsers today. It is also defined to work in XML context (when it is used in an XML document).
  • classList is a convenient accessor for className. The object it returns, exposes methods (contains(), add(), remove(), and toggle()) for manipulating the element's classes. The a, area and link elements have a similar attribute called relList that provides the same functionality for the rel attribute.
     Source : http://www.w3.org/

No comments:

Post a Comment