HTML vs XHTML

Compliance with other specifications

+ This specification defines version 5 of the HTML syntax, known as + "HTML5". - This specification defines the latest HTML syntax, known simply as - "HTML". + This specification defines version 5 of the XHTML syntax, known as + "XHTML5". - This specification defines the latest XHTML syntax, known simply as - "XHTML".

Structure of this specification

-
Microdata
- -
This specification introduces a mechanism for adding - machine-readable annotations to documents, so that tools can - extract trees of name/value pairs from the document. This section - describes this mechanism and some algorithms - that can be used to convert HTML documents into other - formats. - - This section also defines some Microdata vocabularies for contact - information, calendar events, and licensing works. - -
-
The communication APIs
- -
This section describes some mechanisms that applications - written in HTML can use to communicate with other applications from - different domains running on the same client. -

Conformance requirements

Character encodings

+

The term "HTML5 validator" can be used to refer to a + conformance checker that itself conforms to the applicable + requirements of this specification.

-

The term "HTML validator" can be used to refer to a - conformance checker that itself conforms to the applicable - requirements of this specification.

Colors

Vaguer moments in time
-

The 2D graphics - context has a separate color syntax that also handles - opacity.

Dynamic changes to base URLs

-

If the hyperlink has a ping attribute and its absolute URL(s) are being shown to the - user, then the ping - attribute's tokens should be re-resolved relative to the element and the UI updated - appropriately.

HTMLOptionsCollection
-
-
HTMLPropertiesCollection
- -

The HTMLPropertiesCollection interface represents a - collection of elements that add - [93 lines skipped] - title="dom-itemValue">itemValue DOM property of each of the - elements represented by the object, in tree order.

- -
-

Documents in the DOM

- // dynamic markup insertion - attribute DOMString innerHTML; - HTMLDocument open(in optional DOMString type, in optional DOMString replace); - WindowProxy open(in DOMString url, in DOMString name, in DOMString features, in optional boolean replace); - void close(); - [85 lines skipped] - SECURITY_ERR exception whenever any of the members of - an HTMLDocument object are accessed by scripts whose - effective script origin is not the same as the Document's effective - script origin.

-

Resource metadata management

- -
- -
document . URL
- [312 lines skipped] - title="dom-document-readyState">readyState IDL - attribute must, on getting, return the current document - readiness.

- - -

DOM tree accessors

- -

The html element of a document is the - document's root element, if there is one and it's an - html element, or null otherwise.

- [478 lines skipped] - -

The dir - attribute on the HTMLDocument interface is defined - along with the dir content - attribute.

-

Creating documents

- -

XML documents can be created from script using the - createDocument() - [63 lines skipped] -

  • Return doc.

  • - - - - -

    Elements

    -

    Semantics

    - -

    Elements, attributes, and attribute values in HTML are defined - (by this specification) to have certain meanings (semantics). For - example, the ol element represents an ordered list, and - [88 lines skipped] - -

    HTML has a progress element that - describes a progress bar. If its "value" attribute is dynamically - updated by a script, the UA would update the rendering to show the - progress changing.

    -

    Elements in the DOM

    - -

    The nodes representing HTML elements in the DOM - must implement, and expose to scripts, the - interfaces listed for them in the relevant sections of this - [36 lines skipped] - attribute DOMString itemId; - [PutForwards=value] readonly attribute DOMSettableTokenList itemRef; - [PutForwards=value] readonly attribute DOMSettableTokenList itemProp; - readonly attribute HTMLPropertiesCollection properties; - attribute any itemValue;

    Global attributes

    -
  • itemid
  • -
  • itemprop
  • -
  • itemref
  • -
  • itemscope
  • -
  • itemtype
  • Flow content
    -
  • link (if the itemprop attribute is present)
  • -
  • meta (if the itemprop attribute is present)
  • Phrasing content
    -
  • link (if the itemprop attribute is present)
  • -
  • meta (if the itemprop attribute is present)
  • The link element

    Paragraphs
    Interactive content
    -
    If the itemprop attribute is present: flow content.
    -
    If the itemprop attribute is present: phrasing content.
    -
    If the itemprop attribute is present: where phrasing content is expected.
    -

    A link element must have either a rel attribute, or an itemprop attribute, or both.

    +

    A link element must have rel attribute.

    -
    If the itemprop attribute is present: flow content.
    -
    If the itemprop attribute is present: phrasing content.
    -
    If the itemprop attribute is present: where metadata content is expected.
    -
    If the itemprop attribute is present: where phrasing content is expected.
    -

    Exactly one of the name, - http-equiv, charset, and itemprop attributes must be - specified.

    - -

    If either name, http-equiv, or itemprop is specified, then the content attribute must also be - specified. Otherwise, it must be omitted.

    +

    Exactly one of the name, + http-equiv, and charset attributes must be + specified.

    + +

    If either name or http-equiv is specified, then + the content attribute must + also be specified. Otherwise, it must be omitted.

    The a element

    Inline documentation for external scripts
    -
    ping
    - attribute DOMString ping; - ping, - and ping - ping,

    The img element

    + + For guidance on accessibility requirements for text alternatives + authors are encouraged to also consult + WCAG 2.0. + [WCAG] - User agents may also apply heuristics to help the user make use of - the image when the user is unable to see it, e.g. due to a visual - disability or because they are using a text terminal with no - graphics capabilities. Such heuristics could include, for instance, - optical character recognition (OCR) of text found within the image.

    The param element

    Guidance for conformance checkers
    - zero or more track elements, then - zero or more track elements, then
    Video and audio codecs for video elements
    - zero or more track elements, then - zero or more track elements, then

    The source element

    Audio codecs for audio elements
    - or track elements. -

    The track element

    - -
    -
    Categories
    -
    None.
    - [147 lines skipped] - title="dom-track-srclang">srclang must - reflect the respective content attributes of the same - name.

    - -

    Media elements

    - // timed tracks - readonly attribute TimedTrack[] tracks; - MutableTimedTrack addTrack(in DOMString label, in DOMString kind, in DOMString language);
    Loading the media resource
    -
  • Forget the media element's media-resource-specific - timed tracks.

  • -
  • Forget the media element's media-resource-specific - timed tracks.

  • -
  • Forget the media element's - media-resource-specific timed tracks.

  • - and once the timed tracks are ready -
    If the media resource is found to declare a media-resource-specific timed track that the user agent supports
    - -
    - -

    Run the steps to expose a media-resource-specific timed - track with the relevant data.

    - -
    The ready states
    - The timed tracks - are ready.
    Seeking
    -
    Timed tracks
    - -
    Timed track model
    - -

    A media element can have a group of associated WebSRT parser has finished.

    - - - -
    Time ranges
    - and the timed tracks are ready.

    The canvas element

    Security and privacy considerations
    -

    This specification only defines one context, with the name "2d". If getContext() is called with - that exact string for its contextId argument, - then the UA must return a reference to an object implementing - CanvasRenderingContext2D. Other specifications may - define their own contexts, which would return different - objects.

    +

    Contexts are defined by other specifications, for example the 2D + Context specification. [2DCONTEXT]

    -
    - -
    The 2D context
    - - - -

    When the getContext() - method of a canvas element is invoked with 2d as the argument, a - CanvasRenderingContext2D object is returned.

    - - -
    -

    There is only one CanvasRenderingContext2D object - per canvas, so calling the getContext() method with the - 2d argument a second time - must return the same object.

    - [3371 lines skipped] - - </script> - - -

    The area element

    Security with canvas elements
    -
    ping
    - attribute DOMString ping; - and ping - ping, - ping,

    The caption element

    Processing model
    -

    This provides the user with more context:

    - - -
    -

    Table 1. - [8 lines skipped] -

    3 4 5 6 7 8 9 -
    4 5 6 7 8 9 10 -
    5 6 7 8 9 10 11 -
    6 7 8 9 10 11 12 -

    Examples

    Forming a table
    -

    This table could look like this:

    - - - - - [23 lines skipped] -
    Gross margin percentage - 34.3% - 34.0% - 29.0% -
    Using the accesskey attribute to define a command on other elements
    The cells
    -

    The device element

    - -
    -
    Categories
    -
    Flow content.
    - [216 lines skipped] -

    To prevent network sniffing from allowing a - fourth party to establish a connection to a peer using the - information sent out-of-band to the other peer and thus spoofing the - client, the configuration information should always be transmitted - using an encrypted connection.

    Hyperlink elements

    -

    The ping attribute, if - present, gives the URLs of the resources that are interested in - being notified if the user follows the hyperlink. The value must be - a set of space-separated tokens, each of which must be - a valid non-empty URL. The value is - used by the user agent for hyperlink - auditing.

    Following hyperlinks

    -
    - -
    Hyperlink auditing
    - -

    If an a or area hyperlink element has a - [130 lines skipped] - -

    - -

    Pseudo-classes

    Other link types
    Link type "prev"
    -
    - -

    Microdata

    - - -

    Introduction

    -

    Overview

    - -

    This section is non-normative.

    - -

    Sometimes, it is desirable to annotate content with specific - machine-readable labels, e.g. to allow generic scripts to provide - services that are customised to the page, or to enable content from - a variety of cooperating authors to be processed by a single script - in a consistent manner.

    - -

    For this purpose, authors can use the microdata features - described in this section. Microdata allows nested groups of - name-value pairs to be added to documents, in parallel with the - existing content.

    -

    The basic syntax

    - -

    This section is non-normative.

    - -

    At a high level, microdata consists of a group of name-value - [192 lines skipped] - document, in the former case, the item will be included in the - drag-and-drop data. In neither case is the image in any way - associated with the item.

    - -
    -

    Typed items

    - -

    This section is non-normative.

    - -

    The examples in the previous section show how information could - [34 lines skipped] - the properties, thus defining a vocabulary: a property named "class" - given for an item with the type "http://census.example/person" might - refer to the economic class of an individual, while a property named - "class" given for an item with the type "http://example.com/school/teacher" - might refer to the classroom a teacher has been assigned.

    -

    Global identifiers for items

    - -

    This section is non-normative.

    - -

    Sometimes, an item gives - [45 lines skipped] - for something other than the resource actually designated by the URL - leads to a situation where it is ambiguous whether the identifier, - and thus the set of properties specified in the microdata, - references the page or something else.

    - --> -

    Selecting names when defining vocabularies

    - -

    This section is non-normative.

    - -

    Using microdata means using a vocabulary. For some purposes, an - [73 lines skipped] - img - .../hedral.jpeg - - -

    -

    Using the microdata DOM API

    - -

    This section is non-normative.

    - -

    The microdata becomes even more useful when scripts can use it to - [137 lines skipped] - -

    (The duplicate occurrence of "http://example.com/color" is not included - in the list.)

    - - -

    Encoding microdata

    -

    The microdata model

    - -

    The microdata model consists of groups of name-value pairs known - as items.

    - - [16 lines skipped] - relevant type for a typed item is the item's item type, if it has - one, or else is the relevant type of the item for which it is a property's value.

    -

    Items

    - -

    Every HTML element may have an - itemscope attribute - specified. The itemscope - [106 lines skipped] - subtree.

    - -

    The itemref attribute must not - be specified on elements that do not have an itemscope attribute specified.

    -

    Names: the itemprop attribute

    - -

    Every HTML element may have an - itemprop attribute specified, if - doing so adds a - [95 lines skipped] - <p itemprop="a">1</p> - </div> - - - -

    Values

    - -

    The property value of a - name-value pair added by an element with an itemprop attribute depends on the - [78 lines skipped] - title="concept-time">time, or global date and time, the property - must be specified using the datetime attribute of a - time element.

    -

    Associating names with items

    - -

    To find the properties of an item defined by the - element root, the user agent must try to - crawl the properties of the element license -

    http://www.opensource.org/licenses/mit-license.php -
    - - -

    Microdata DOM API

    -
    - -
    document . getItems( [ types ] )
    - -
    - [178 lines skipped] - -
    for (var index = 0; index < element.itemRef.length; index += 1)
    -   process(document.getElementById(element.itemRef[index]));
    - -

    Drag-and-drop

    -

    Microdata vocabularies

    -

    vCard

    - - -

    An item with the item type http://microformats.org/profile/hcard - [2026 lines skipped] - FN:George Washington - N:Washington;George;;; - END:VCARD - - -

    vEvent

    - - -

    An item with the item type http://microformats.org/profile/hcalendar#vevent - [954 lines skipped] - itemprop="url">See this event on livebrum.co.uk</a>.</p> - <meta itemprop="description" content="via livebrum.co.uk"> - </div> - - -

    Licensing works

    - - -

    An item with the item type http://n.whatwg.org/work - [133 lines skipped] - - - - -

    -

    Converting HTML to other formats

    -

    JSON

    - -

    Given a list of nodes nodes in a - Document, a user agent must run the following algorithm - to extract the microdata from those - [90 lines skipped] - title="">properties.

    - -
  • Return result.

  • - - -

    RDF

    - -

    To convert a Document to - RDF, a user agent must run the following algorithm:

    - - [500 lines skipped] - -
    - - - -

    Atom

    - -

    Given a Document source, a user - agent may run the following algorithm to extract an Atom feed. This is not the only algorithm - [546 lines skipped] - document does not have any <meta name="author" - content="..."> elements), then the output will not be - conforming.

    - -

    The Atom namespace is: http://www.w3.org/2005/Atom

    The Window object

    Browsing context names

    Navigating auxiliary browsing contexts in the DOM
    - void postMessage(in any message, in DOMString targetOrigin, in optional MessagePortArray ports);

    Drag-and-drop processing model

    Security and privacy
    -
  • - -

    The user agent must take the list of dragged nodes - and extract the microdata from those - nodes into a JSON form, and then must add the resulting - string to the dataTransfer member, - associated with the application/microdata+json format.

    - -
  • + +
  • Perform drag-and-drop initialization steps defined + in other relevant specificaations.
  • Worker locations

    Shared workers and the SharedWorker interface
    -

    Communication

    - -
    -

    Event definitions

    - -

    Messages in server-sent events, Web - sockets, cross-document messaging, and - channel messaging use the source attribute must be - null, and the ports - attribute must be null.

    - -
    Acknowledgements
    Sec-WebSocket-Protocol
    - - - - - - [18 lines skipped] -

    The task source for the tasks in cross-document - messaging is the posted message task source.

    - - -

    Introduction

    - -

    This section is non-normative.

    - -
    - [82 lines skipped] - information from one domain to another domain, which is normally - disallowed for security reasons. It also requires that UAs be - careful to allow access to certain properties but not others.

    - -
    -

    Posting messages

    - -
    - -
    window . postMessage(message, targetOrigin [, ports ])
    - [143 lines skipped] - - - - - -

    Channel messaging

    -

    Introduction

    - -

    This section is non-normative.

    - -

    To enable independent pieces of code (e.g. running in different - [29 lines skipped] -

    channel.port1.onmessage = handleMessage;
    - function handleMessage(event) {
    -   // message is in event.data
    -   // ...
    - }
    -

    Message channels

    - -
    [Constructor]
    - interface MessageChannel {
    -   readonly attribute MessagePort port1;
    - [70 lines skipped]
    -   port2 attributes
    -   must return the values they were assigned when the
    -   MessageChannel object was created.

    - - -

    Message ports

    - -

    Each channel has two message ports. Data sent through one port is - received by the other port, and vice versa.

    - - [382 lines skipped] - objects and discarding them without closing them can lead to high - memory usage.

    - - -

    Embedded content

    Scripts that modify the page as it is being parsed
    Executing SQL statements
    -

    pointer to rendering model for timed tracks

    -
    -

    Timed tracks

    - -

    rendering model for timed tracks

    - -

    CSS extensions

    - -

    Links, forms, and navigation

    -

    User agents are expected to inform the user of whether a - hyperlink includes hyperlink auditing, and - to let them know at a minimum which domains will be contacted as - part of such auditing.

    text/cache-manifest

    Other elements, attributes and APIs

    -

    text/ping

    - -

    This registration is for community review and will be submitted - to the IESG for review, approval, and registration with IANA.

    - - [57 lines skipped] -
    WHATWG
    -
    - -

    Fragment identifiers have no meaning with - text/ping resources.

    -

    text/srt

    - -

    This registration is for community review and will be submitted - to the IESG for review, approval, and registration with IANA.

    - - [60 lines skipped] -
    WHATWG
    -
    - -

    Fragment identifiers have no meaning with - text/srt resources.

    application/microdata+json

    -

    application/microdata+json

    - -

    This registration is for community review and will be submitted - to the IESG for review, approval, and registration with IANA.

    - - [62 lines skipped] - -

    Fragment identifiers used with - application/microdata+json resources have the same - semantics as when used with application/json. [JSON]

    -

    Ping-From

    - -

    This section describes a header field for registration in the - Permanent Message Header Field Registry. [RFC3864]

    - [12 lines skipped] - This document is the relevant specification. - -
    Related information
    -
    None.
    -
    -

    Ping-To

    - -

    This section describes a header field for registration in the - Permanent Message Header Field Registry. [RFC3864]

    - [12 lines skipped] - This document is the relevant specification. - -
    Related information
    -
    None.
    - - ping; - ping; - - track - Timed track - none - audio; - video - empty - globals; - kind; - label; - src; - srclang - HTMLTrackElement - - link (if the itemprop attribute is present); - meta (if the itemprop attribute is present); - link (if the itemprop attribute is present); - -->; meta (if the itemprop attribute is present)