https://wiki.whatwg.org/api.php?action=feedcontributions&user=Jdandrea&feedformat=atomWHATWG Wiki - User contributions [en]2024-03-29T07:00:07ZUser contributionsMediaWiki 1.39.3https://wiki.whatwg.org/index.php?title=HTML_vs._XHTML&diff=2256HTML vs. XHTML2007-05-09T13:47:36Z<p>Jdandrea: Adjusting link to Changes from HTML4</p>
<hr />
<div>== Differences Between HTML and XHTML ==<br />
<br />
'''Please note that the information in here is based upon the current spec for (X)HTML5. Some of the issues technically do not apply to previous versions of HTML.'''<br />
<br />
Although HTML and XHTML appear to have similarities in their syntax, they are significantly different in many ways.<br />
<br />
'''Note''': As the current WHATWG document is a draft, this section will need to track to a moving target.<br />
Differences marked @@@ are differences that could theoretically be changed without affecting <br />
backwards compatibility.<br />
<br />
=== MIME Types ===<br />
<br />
* XHTML must be served with an XML MIME type, such as <code>application/xml</code> or <code>application/xhtml+xml</code>.<br />
* HTML must be served as <code>text/html</code>.<br />
<br />
It is the MIME type that determines what type of document you are using. If you use attempt to send XHTML as <code>text/html</code>, you are actually just using HTML, possibly with syntax errors.<br />
<br />
Technically, according to the spec, XHTML 1.0 is allowed to be served as <code>text/html</code>. But, due to the above reason, such a document is considered to be an HTML document, not an XHTML document.<br />
<br />
=== Parsing ===<br />
<br />
XHTML uses XML parsing requirements. HTML uses its own which are defined much more closely to the way browsers actually handle HTML today.<br />
<br />
* In XHTML, well-formedness errors are fatal. In HTML, error handling rules are much more graceful. Well-formedness errors, which are also syntax errors in HTML, include the following:<br />
** Unencoded ampersands (<code>&amp;</code> instead of <code>&amp;amp;</code>), and less than signs (<code>&lt;</code> instead of <code>&amp;lt;</code>) (This does not apply to <code>CDATA</code>).<br />
** Comments containing extra pairs of hyphens or ending with a hyphen. e.g.<br />
*** <code>&lt;!--<var> syntax -- error </var>--&gt;</code> or<br />
*** <code>&lt;!--<var> syntax error -</var>--&gt;</code>.<br />
** Mismatched end tags (does not apply to elements with optional tags) <br />
** Unclosed tags.<br />
** Unexpected characters occuring in or before attribute names.<br />
** Unexpected occurrence of EOF.<br />
** Unexpected characters before the DOCTYPE name.<br />
** Missing DOCTYPE name.<br />
** A <code>PUBLIC</code> identifer in a <code>DOCTYPE</code> without a <code>SYSTEM</code> identifier (Note: including either of these is a syntax error in HTML5; but, in XML only the <code>SYSTEM</code> identifier is allowed to occur on its own).<br />
** End tags with attributes. <br />
** Unexpected end tags (in HTML, an unexpected <code>&lt;/br></code> or <code>&lt;/p></code> can cause the start tag to be implied before it).<br />
* The internal subset is permitted in XML, but meaningless (and forbidden) in HTML.<br />
** In some cases, an internal subset in HTML would end up being partly rendered inline.<br />
* The sequence of characters &quot;<code>]]&gt;</code>&quot; in content when it does not mark the end of a <code>CDATA</code> section is a well-formedness error in XHTML, but valid in HTML.<br />
* In XHTML: <code>&lt;![CDATA[...]]&gt;</code> is a <code>CDATA</code> section. In HTML, it's a bogus comment.<br />
* In XHTML, <code>&lt;?foo ...?&gt;</code> is a processing instruction. In HTML, it's a bogus comment.<br />
* In HTML, the trailing slash used for the empty element syntax is a parse error for non-void elements (see below), but is ignored in all cases.<br />
* In HTML, the <code>script</code> and <code>style</code> elements are parsed as <code>CDATA</code>. (Note: the definition of <code>CDATA</code> differs from that in XML). In XML, they're parsed as normal elements (which means that comments are treated as <em>real</em> comments, and things that look like start tags actually are start tags).<br />
* In HTML, the <code>title</code> and <code>textarea</code> elements are parsed as <code>RCDATA</code>. (Note: The definition of <code>RCDATA</code> differs from that in SGML and there is no <code>RCDATA</code> in XML).<br />
* In HTML, if scripting is enabled, the <code>noscript</code> element is parsed as <code>CDATA</code>. If scripting is disabled, it's parsed as <code>PCDATA</code>. In XHTML, the element has no effect, and can't really be used to stop content from being present when script is disabled.<br />
* In HTML, the <code>iframe</code>, <code>noembed</code> and <code>noframes</code> elements are parsed as <code>CDATA</code>. In XHTML, they are parsed as normal elements, and therefore do not stop content from being used.<br />
* White space characters in attribute values are [http://www.w3.org/TR/REC-xml/#AVNormalize normalized] to spaces in XHTML.<br />
* In HTML, elements with optional tags are implied in certain conditions.<br />
* In HTML, <code>base</code>, <code>link</code>, <code>meta</code>, <code>style</code> and <code>title</code> elements with tags occurring in the body are moved inserted into the head. In XHTML, they stay where they were specified.<br />
* In HTML, tags for certain elements, which appear out of context, are ignored. This includes <code>caption</code>, <code>col</code>, <code>colgroup</code>, <code>frame</code>, <code>frameset</code>, <code>head</code>, <code>option</code>, <code>optgroup</code>, <code>tbody</code>, <code>td</code>, <code>tfoot</code>, <code>th</code>, <code>thead</code>, <code>tr</code>.<br />
* The <code>plaintext</code> element has a special parsing requirement in HTML. (It is, however, forbidden.)<br />
* <em>Many other special handling of edge cases and error conditions, not all of which are listed here, occur in HTML.</em><br />
<br />
=== Syntax ===<br />
<br />
* In HTML, [http://blog.whatwg.org/faq/#doctype the <code>doctype</code> is required]. In XHTML, it is optional.<br />
* In XHTML, tag names and attribute names are case sensitive. In HTML, they are case insensitive.<br />
* In XHTML, non-empty elements require both a start and an end tag. In HTML, certain elements allow the omission of either or both:<br />
** <code>html</code> (both)<br />
** <code>head</code> (both)<br />
** <code>body</code> (both)<br />
** <code>li</code> (end tag)<br />
** <code>dt</code> (end tag)<br />
** <code>dd</code> (end tag)<br />
** <code>p</code> (end tag)<br />
** <code>colgroup</code> (both)<br />
** <code>thead</code> (end tag)<br />
** <code>tbody</code> (both)<br />
** <code>tfoot</code> (end tag)<br />
** <code>tr</code> (end tag)<br />
** <code>td</code> (end tag)<br />
** <code>th</code> (end tag)<br />
* In XHTML, empty elements may use either the empty element syntax (<code>&lt;br/&gt;</code>) or have an end tag immediately follow the start tag (<code>&lt;br&gt;&lt;/br&gt;</code>). In HTML, the empty element syntax (trailing slash) is allowed on void elements, but forbidden on other elements. However, it serves no purpose whatsoever and can be omitted. End tags for void elements are forbidden.<br />
** <code>base</code>,<code> link</code>, <code>meta</code>, <code>hr</code>, <code>br</code>, <code>img</code>, <code>embed</code>, <code>param</code>, <code>area</code>, <code>col</code> and <code>input</code><br />
** Note: the following are treated as void elements for the purpose in the parsing requirements, but, as they are obsolete and non-standard, the trailing slash is not permitted: <code>basefont</code>, <code>b</code><code>gsound</code>, <code>spacer</code>, <code>wbr</code>. (although, since these elements are not permitted anyway, it doesn't make much difference).<br />
* HTML allows attribute minimisation (i.e. omitting the value), XHTML does not.<br />
* HTML allows the use of unquoted attribute values, XHTML does not.<br />
* XHTML allows the use of <code>CDATA</code> sections, HTML does not.<br />
* XHTML allows the use of processing instructions, HTML does not.<br />
* In HTML, all entity references are predefined and do not require a DTD. But because there is no DTD for XHTML5, entity references cannot be used in XHTML. (excluding the 5 predefined entities: <code>&amp;amp;</code>, <code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;quot;</code> and <code>&amp;apos;)</code><br />
** You may provide your own DTD for use with your own validating parser, but be aware that browsers do not use validating parsers and will not read the DTD.<br />
* The valid set of unicode characters in XML 1.0 is limited beyond that in HTML.<br />
* Namespace prefixes are permitted in XHTML. They are forbidden in HTML. <br />
<br />
=== Markup ===<br />
<br />
* The [http://blog.whatwg.org/faq/#namespace-decl namespace declaration] (<code>xmlns</code> attribute) is required in XHTML. The xmlns attribute is also allowed to appear on the <code>html</code> element in HTML on the condition that is has the value <code><nowiki>"http://www.w3.org/1999/xhtml"</nowiki></code>.<br />
** <code><nowiki>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</nowiki></code><br />
** In HTML, the xmlns attribute has absolutely no effect. It is basically a talisman. It is allowed merely to make migration to and from XHTML mildly easier. When parsed by an HTML parser, the attribute ends up in the null namespace<br />
** In XML (with an [http://www.w3.org/TR/xml-names/ XML Namespaces]-aware parser), an xmlns attribute is part of the namespace declaration mechanism, and an element cannot actually have an xmlns attribute in the null namespace. In DOM implementations, the attribute ends up in the "<code><nowiki>http://www.w3.org/2000/xmlns/</nowiki></code>" namespace.<br />
* XHTML allows non XHTML elements and attributes (in different namespaces) to be used, HTML does not.<br />
* XHTML uses the <code>xml:lang</code> attribute, HTML uses <code>lang</code> instead,<br />
* XML ID introduces <code>xml:id</code>, which could be used in XHTML. In HTML it has no effect.<br />
* In HTML, the <code>noscript</code> element may be used. In XHTML, it is forbidden.<br />
* HTML uses the <code>base</code> element, XHTML uses <code>xml:base</code> instead. <br />
* In XHTML, <code>p</code> elements may contain structured inline level elements including <code>blockquote</code>, <code>dl</code>, <code>menu</code>, <code>ol</code>, <code>ul</code>, <code>pre</code> and <code>table</code>. In the HTML serialisation, due to backwards compatibility constraints, this is not possible (though it may be done through DOM manipulation).<br />
* In XHTML, <code>table</code> elements may contain child <code>tr</code> elements. In the HTML serialisation, due to backwards compatibility constraints, this is not possible (though it may be done through DOM manipulation).<br />
<br />
=== Character Encoding ===<br />
<br />
* In XHTML, the XML declaration may be used to [http://blog.whatwg.org/faq/#charset specify the character encoding]. In HTML, the XML declaration is forbidden<br />
* In HTML, the <code>meta</code> element with a <code>charset</code> attribute may be used instead. It is forbidden in XHTML and is ignored if included.<br />
* The default character encoding for XHTML is, according to XML rules, <code>UTF-8</code> or <code>UTF-16</code>. If the encoding is unspecified in HTML, it should be determined through implementation specific heuristics or fallback to a default value (Note: this section of the spec is not yet finished).<br />
<br />
=== Scripts ===<br />
<br />
* <code>document.write()</code> and <code>document.writeln()</code> cannot be used in XHTML, they can in HTML. <br />
* In XHTML, the use of the <code>innerHTML</code> property requires that the string be a well-formed fragment of XML. <br />
* DOM APIs are case sensitive in XHTML and some are case insensitive in HTML. (This does not apply to elements which are not in the HTML namespace)<br />
** Element.tagName, Node.nodeName, and Node.localName return the value in uppercase.<br />
** Document.createElement() is case insensitive (the canonical form is lowercase).<br />
** Element.setAttributeNode() will change the attribute name to lowercase.<br />
** Element.setAttribute() is case insensitive (the canonical form is lowercase).<br />
** Document.getElementsByTagName() and Element.getElementsByTagName() are case insensitive.<br />
** Document.renameNode(). If the new namespace is the HTML namespace, then the new qualified name must be lowercased before the rename takes place.<br />
* In HTML, Document.createElement() will create an element in the HTML namespace. In XML (including XHTML), the namespace is defined by both DOM2 and DOM3 to be null.<br />
** In XHTML, browsers lack interoperability in this area. In Firefox, the namespace is dependent upon the MIME type. In Opera, it's dependent upon the root element and in Safari, it's always null.<br />
<br />
=== Stylesheets ===<br />
<br />
* Selectors, as used in CSS, match case sensitively in XHTML, but case insensitively in HTML.<br />
* CSS requires special handling of the body element in HTML for painting backgrounds on the canvas, which do not apply to XHTML.<br />
<br />
== Differences Between HTML 4.01 and HTML 5 ==<br />
<br />
See [[Differences from HTML4]].<br />
<br />
== Differences Between DOM Level 2.0, 3.0 and the HTML 5 DOM APIs ==<br />
<br />
'''This section might belong on a separate page.'''<br />
<br />
* TODO (need to talk about the changes to the DOM API that HTML5 is making, compared with DOM2 and DOM3)<br />
<br />
== Translations ==<br />
<br />
* [http://meiert.com/de/publications/translations/whatwg.org/html-vs-xhtml/ German translation: "HTML 5 und XHTML 5 im Vergleich (WHATWG)"]</div>Jdandreahttps://wiki.whatwg.org/index.php?title=Main_Page&diff=2255Main Page2007-05-09T13:46:10Z<p>Jdandrea: Adjusting Changes from HTML5 link</p>
<hr />
<div>Welcome to the WHATWG Wiki!<br />
<br />
You can be a part of our community, making proposals for the next version of HTML5. This wiki is made available for you for drafting proposals, for writing essays, for keeping track of HTML-related issues, and so forth. Anyone can create an account and contribute content.<br />
<br />
Before you begin, you may wish to read our [[WHATWG Wiki:Contribution Guidelines|contribution guidelines]].<br />
<br />
==Purpose==<br />
The purpose of the WHATWG Wiki is to create a place for WHATWG contributors to post and compile their own proposals and ideas regarding WHATWG specifications. The specifications themselves will not be available for editing via this wiki. However, ideas you post here may find their way into current and future WHATWG specifications.<br />
<br />
== Main sections and Quick links ==<br />
* [[Implementations]].<br />
* [[What you can do]].<br />
* [[Differences from HTML4|HTML5 differences from HTML4]].<br />
* [[HTML vs. XHTML]].<br />
* [[HTML5 Presentations]].<br />
* [[Feature Proposals]].<br />
<br />
==WHATWG Specifications==<br />
* [[Web Forms 2.0]]<br />
* [[Web Applications 1.0]]<br />
* [[Web Controls 1.0]]<br />
<br />
==Communicating with the community==<br />
The WHATWG community has several channels of communication:<br />
* [http://www.whatwg.org/mailing-list Mailing lists]<br />
* [http://blog.whatwg.org/ The blog]<br />
* [http://wiki.whatwg.org/ This wiki]<br />
* [[IRC]]<br />
* [http://forums.whatwg.org/ The forum]</div>Jdandreahttps://wiki.whatwg.org/index.php?title=Changes_from_HTML4&diff=2254Changes from HTML42007-05-09T13:44:41Z<p>Jdandrea: Moved to "Differences from HTML4"</p>
<hr />
<div>#REDIRECT [[Differences from HTML4]]</div>Jdandreahttps://wiki.whatwg.org/index.php?title=Differences_from_HTML4&diff=2253Differences from HTML42007-05-09T13:43:37Z<p>Jdandrea: Copied from "Changes from HTML4"</p>
<hr />
<div>== Global overview ==<br />
<br />
HTML5 is different from HTML4 in a way that it addresses both document and application semantics making it more suitable for the web applications created today. HTML5 also reflects implementations better where they differ from HTML4 to ensure the language is implementable and compatible with the web. Inspired by the forward compatible error handling in CSS HTML5 defines detailed processing models where necessary to ensure that implementations become interoperable and that the language stays extensible in the future.<br />
<br />
HTML5 also integrates a new version of DOM Level 2 HTML so the element-specific APIs are defined along with the rest of the language. Because the language is mostly defined in terms of the DOM it's very easy to get an XML serialization as well. This XML serialization is called XHTML5 and is basically an update to XHTML1.x.<br />
<br />
== Syntax ==<br />
<br />
; Writing HTML5: HTML5 specifies its own syntax rules authors have to follow. HTML5 documents can be written in a way that looks exactly like XHTML although this does not imply that parsing such a document with an HTML parser will give the same result as parsing it with an XML parser.<br />
; Parsing HTML5: HTML5 defines its own parsing rules (including "error correction") for text/html resources and no longer pretends that HTML is an application of SGML.<br />
<br />
== Elements and Attributes ==<br />
<br />
=== New elements ===<br />
<br />
==== Document Structure ====<br />
<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-article article]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-aside aside]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-dialog dialog]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-figure figure]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-footer footer]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-header header]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-nav nav]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-section section]<br />
<br />
==== Data ====<br />
<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#audio audio]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-embed embed]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-m m]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-meter meter]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-source source]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-time time]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-video video]<br />
<br />
==== Applications ====<br />
<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-canvas canvas]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-command command]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-datagrid datagrid]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-details details]<br />
* [http://www.whatwg.org/specs/web-forms/current-work/#the-datalist datalist] (Web Forms 2)<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-event-source event-source]<br />
* [http://www.whatwg.org/specs/web-forms/current-work/#the-output output] (Web Forms 2)<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-progress progress]<br />
<br />
In addition to the above the input element's type attribute can now have the following new values which enables a bunch of new native controls:<br />
<br />
* datetime<br />
* datetime-local<br />
* date<br />
* month<br />
* week<br />
* time<br />
* number<br />
* range<br />
* email<br />
* url<br />
<br />
=== New Attributes ===<br />
<br />
An overview of all elements from HTML4 that got new attributes in HTML5.<br />
<br />
{|<br />
! Element !! Attributes<br />
|-<br />
| a || media?, ping<br />
|-<br />
| area || ping<br />
|-<br />
| base || target<br />
|-<br />
| button || autofocus, form, replace, template<br />
|-<br />
| fieldset || disabled, form<br />
|-<br />
| form || data, replace<br />
|-<br />
| input || autocomplete, autofocus, form, inputmode, list, min, max, pattern, step, replace, required, template<br />
|-<br />
| li || value (no longer deprecated)<br />
|-<br />
| meta || charset<br />
|-<br />
| ol || start (no longer deprecated)<br />
|-<br />
| select || autofocus, data, form<br />
|-<br />
| script || async, defer<br />
|-<br />
| style || scoped<br />
|-<br />
| textarea || autofocus, form, inputmode, required<br />
|}<br />
<br />
HTML4 didn't have a concept of an attribute that applies to every element. HTML5 calls such attributes global attributes. The following attributes from HTML4 are made global attributes:<br />
<br />
* class<br />
* dir<br />
* id<br />
* lang<br />
* title<br />
<br />
The following new attributes are global attributes:<br />
<br />
* contenteditable<br />
* contextmenu<br />
* draggable<br />
* tabindex<br />
<br />
HTML5 also has global attributes that also can be applied on elements from other vocabularies (when namespaced):<br />
<br />
* repeat (Web Forms 2)<br />
* repeat-start (Web Forms 2)<br />
* repeat-min (Web Forms 2)<br />
* repeat-max (Web Forms 2)<br />
<br />
=== Changed Elements ===<br />
<br />
These elements have new meanings in HTML5 which are incompatible with HTML4. The new meanings better reflects the way they are used on the Web or gives them a purpose so people can start using them.<br />
<br />
; [http://www.whatwg.org/specs/web-apps/current-work/#the-a a]: The a element without an href attribute represents a "placeholder link".<br />
; [http://www.whatwg.org/specs/web-apps/current-work/#the-address address]: The address element is now scoped by the new concept of sectioning.<br />
; [http://www.whatwg.org/specs/web-apps/current-work/#the-b b]: The b element now represents a span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is emboldened.<br />
; [http://www.whatwg.org/specs/web-apps/current-work/#the-hr hr]: The hr element now represents a paragraph-level thematic break.<br />
; [http://www.whatwg.org/specs/web-apps/current-work/#the-i i]: The i element now represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, a ship name, or some other prose whose typical typographic presentation is italicized. Usage varies widely by language.<br />
; [http://www.whatwg.org/specs/web-apps/current-work/#the-menu menu]: The menu element is redefined to be useful for actual menus.<br />
; [http://www.whatwg.org/specs/web-apps/current-work/#the-small small]: The small element now represents small print (for side comments and legal print).<br />
; [http://www.whatwg.org/specs/web-apps/current-work/#the-strong strong]: The strong element now represents importance rather than strong emphasis.<br />
<br />
=== Dropped Elements ===<br />
<br />
That these elements are dropped means that authors are no longer allowed to use them. User agents will still have to support them and HTML5 will probably get a rendering section in due course that says exactly how. (isindex for instance is already supported by the parser.)<br />
<br />
* acronym (use [http://www.whatwg.org/specs/web-apps/current-work/#the-abbr abbr] instead)<br />
* applet (use [http://www.whatwg.org/specs/web-apps/current-work/#the-object object] instead) <br />
* basefont <br />
* big <br />
* center <br />
* dir<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-font font] (allowed when inserted by WYSIWYG editors)<br />
* frame <br />
* frameset <br />
* isindex <br />
* noframes <br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-noscript noscript] (only dropped in XHTML5) <br />
* s <br />
* strike <br />
* tt <br />
* u<br />
<br />
=== Dropped Attributes ===<br />
<br />
Some attributes for elements included in HTML4 are not allowed in HTML5:<br />
<br />
{|<br />
! Element !! Attributes<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-a a] || rev, charset<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-area area] || nohref<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-head head] || profile<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-html html] || version<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-link link] || rev, target, charset<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-map map] || name<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-meta meta] || scheme<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-object object] || archive, standby<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-param param] || valuetype<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-script script] || charset<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-table table] || summary<br />
|-<br />
| [http://www.whatwg.org/specs/web-apps/current-work/#the-td td], [http://www.whatwg.org/specs/web-apps/current-work/#the-th th] || headers, axis<br />
|}<br />
<br />
In addition, HTML5 has none of the presentational attributes that were in HTML4 (including those on &lt;table&gt;. Any attributes defined on ''elements'' that are not in HTML5 are (obviously) also not in HTML5.<br />
<br />
== APIs ==<br />
<br />
HTML5 introduces a number of APIs that should help in creating web applications. These can be used together with the new elements introduced for applications:<br />
<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#the-2d 2D drawing API] which can be used with the new [http://www.whatwg.org/specs/web-apps/current-work/#the-canvas canvas] element<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#media API for playing of video and audio] which can be used with the new [http://www.whatwg.org/specs/web-apps/current-work/#video video] and [http://www.whatwg.org/specs/web-apps/current-work/#audio audio] elements<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#storage Persistent storage]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#offline Online / offline events]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#editing Editing API] in combination with a new global [http://www.whatwg.org/specs/web-apps/current-work/#contenteditable0 contenteditable] attribute<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#dnd Drag & drop API] in combination with a [http://www.whatwg.org/specs/web-apps/current-work/#draggable draggable] attribute.<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#network Network API]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#history API that exposes the history] and allows pages to add to it to prevent breaking the back button.<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#crossDocumentMessages Cross document messaging]<br />
* [http://www.whatwg.org/specs/web-apps/current-work/#server-sent-events Listening to server sent events]<br />
<br />
== Character Encoding ==<br />
<br />
The character encoding can be declared using the meta element, but the syntax of the meta element has changed. In HTML 4.01 and earlier, the meta element was:<br />
<br />
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;<br />
<br />
In HTML5, the syntax was simplified to remove the unnecessary markup, yet still remain compatible with the encoding detection implemented in most existing browsers.<br />
<br />
&lt;meta charset="UTF-8"&gt;<br />
<br />
=== HTML 4 Algorithm ===<br />
<br />
Source [http://www.w3.org/TR/html4/charset.html#h-5.2.2 5.2.2 Specifying the character encoding], HTML 4.01 Specification.<br />
<br />
# An HTTP "charset" parameter in a "Content-Type" field.<br />
# A META declaration with "http-equiv" set to "Content-Type" and a value set for "charset".<br />
# The charset attribute set on an element that designates an external resource.<br />
<br />
=== HTML 5 Algorithm ===<br />
<br />
The exact algorithm that browsers must follow in order to [http://www.whatwg.org/specs/web-apps/current-work/#the-input0 determine the character encoding] is specified in HTML 5. The basic algorithm works as follows:<br />
<br />
# If the transport layer specifies an encoding, use that, and abort these steps. (e.g. The HTTP Content-Type header).<br />
# Read the first 512 bytes of the file, or at least as much as possible if less than that.<br />
# If the file starts with a UTF-8, UTF-16 or UTF-32 BOM, then use that and abort these steps.<br />
# Otherwise use the special algorithm to search the first 512 bytes for a meta element that declares the encoding. The algorithm is relatively lenient in what it will detect, though since it doesn't use the normal parsing algorithm, there are some restrictions.</div>Jdandrea