HTML 5 a Vocabulary and Associated Apis for HTML and XHTML
Total Page:16
File Type:pdf, Size:1020Kb
HTML 5 A vocabulary and associated APIs for HTML and XHTML http://dev.w3.org/html5/spec/Overview.html 1 3/29/2009 5:38 PM W3C Working Draft 12 February 2009 This Version: http://www.w3.org/TR/2009/WD-html5-20090212/ Latest Published Version: http://www.w3.org/TR/html5/ Latest Editor's Draft: http://www.w3.org/html/wg/html5/ Previous Versions: http://www.w3.org/TR/2008/WD-html5-20080610/ http://www.w3.org/TR/2008/WD-html5-20080122/ Editors: Ian Hickson, Google, Inc. David Hyatt, Apple, Inc. Copyright © 2009 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply. http://dev.w3.org/html5/spec/Overview.html 2 3/29/2009 5:38 PM Abstract This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML). In this version, new features are introduced to help Web application authors, new elements are introduced based on research into prevailing authoring practices, and special attention has been given to defining clear conformance criteria for user agents in an effort to improve interoperability. http://dev.w3.org/html5/spec/Overview.html 3 3/29/2009 5:38 PM Status of this document This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the most recently formally published revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/. The WHATWG version of this specification is available under a license that permits reuse of the specification text. If you wish to make comments regarding this document, please send them to [email protected] (subscribe, archives) or [email protected] (subscribe, archives), or submit them using our public bug database. All feedback is welcome. We maintain a list of all e-mails that have not yet been considered and a list of all bug reports that have not yet been resolved. Implementors should be aware that this specification is not stable. Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should join the aforementioned mailing lists and take part in the discussions. The publication of this document by the W3C as a W3C Working Draft does not imply that all of the participants in the W3C HTML working group endorse the contents of the specification. Indeed, for any section of the specification, one can usually find many members of the working group or of the W3C as a whole who object strongly to the current text, the existence of the section at all, or the idea that the working group should even spend time discussing the concept of that section. The latest stable version of the editor's draft of this specification is always available on the W3C CVS server and in the WHATWG Subversion repository. The latest editor's working copy (which may contain unfinished text in the process of being prepared) is also available. There are various ways to follow the change history for the specification: E-mail notifications of changes HTML-Diffs mailing list (diff-marked HTML versions for each change): http://lists.w3.org/Archives/Public/public-html-diffs/latest Commit-Watchers mailing list (complete source diffs): http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org Real-time notifications of changes: Generated diff-marked HTML versions for each change: http://twitter.com/HTML5 All (non-editorial) changes to the spec source: http://twitter.com/WHATWG Browsable version-control record of all changes: CVSWeb interface with side-by-side diffs: http://dev.w3.org/cvsweb/html5/spec/Overview.html Annotated summary with unified diffs: http://html5.org/tools/web-apps-tracker Raw Subversion interface: svn checkout http://svn.whatwg.org/webapps/ http://dev.w3.org/html5/spec/Overview.html 4 3/29/2009 5:38 PM The W3C HTML Working Group is the W3C working group responsible for this specification's progress along the W3C Recommendation track. This specification is the 12 February 2009 Working Draft. This specification is also being produced by the WHATWG. The two specifications are identical from the table of contents onwards. This specification is intended to replace (be a new version of) what was previously the HTML4, XHTML 1.0, and DOM2 HTML specifications. This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy. Stability Different parts of this specification are at different levels of maturity. Some of the more major known issues are marked like this. There are many other issues that have been raised as well; the issues given in this document are not the only known issues! Also, firing of events needs to be unified (right now some bubble, some don't, they all use different text to fire events, etc). http://dev.w3.org/html5/spec/Overview.html 5 3/29/2009 5:38 PM Table of contents 1 Introduction 1.1 Background 1.2 Audience 1.3 Scope 1.4 History 1.5 Relationships to other specifications 1.5.1 Relationship to HTML 4.01 and DOM2 HTML 1.5.2 Relationship to XHTML 1.x 1.5.3 Relationship to XHTML2 and XForms 1.6 HTML vs XHTML 1.7 Structure of this specification 1.7.1 How to read this specification 1.7.2 Typographic conventions 2 Common infrastructure 2.1 Terminology 2.1.1 XML 2.1.2 DOM trees 2.1.3 Scripting 2.1.4 Plugins 2.1.5 Character encodings 2.2 Conformance requirements 2.2.1 Dependencies 2.2.2 Features defined in other specifications 2.2.3 Common conformance requirements for APIs exposed to JavaScript 2.3 Case-sensitivity and string comparison 2.4 Common microsyntaxes 2.4.1 Common parser idioms 2.4.2 Boolean attributes 2.4.3 Numbers 2.4.3.1 Non-negative integers 2.4.3.2 Signed integers 2.4.3.3 Real numbers 2.4.3.4 Ratios 2.4.3.5 Percentages and lengths 2.4.3.6 Lists of integers 2.4.3.7 Lists of dimensions 2.4.4 Dates and times 2.4.4.1 Months 2.4.4.2 Dates 2.4.4.3 Times 2.4.4.4 Local dates and times 2.4.4.5 Global dates and times 2.4.4.6 Weeks 2.4.4.7 Vaguer moments in time 2.4.5 Colors http://dev.w3.org/html5/spec/Overview.html 6 3/29/2009 5:38 PM 2.4.6 Space-separated tokens 2.4.7 Comma-separated tokens 2.4.8 Keywords and enumerated attributes 2.4.9 References 2.5 URLs 2.5.1 Terminology 2.5.2 Parsing URLs 2.5.3 Resolving URLs 2.5.4 Dynamic changes to base URLs 2.5.5 Interfaces for URL manipulation 2.6 Fetching resources 2.6.1 Protocol concepts 2.6.2 Encrypted HTTP and related security concerns 2.7 Determining the type of a resource 2.7.1 Content-Type metadata 2.7.2 Content-Type sniffing: Web pages 2.7.3 Content-Type sniffing: text or binary 2.7.4 Content-Type sniffing: unknown type 2.7.5 Content-Type sniffing: image 2.7.6 Content-Type sniffing: feed or HTML 2.8 Character encodings 2.9 Common DOM interfaces 2.9.1 Reflecting content attributes in DOM attributes 2.9.2 Collections 2.9.2.1 HTMLCollection 2.9.2.2 HTMLFormControlsCollection 2.9.2.3 HTMLOptionsCollection 2.9.3 DOMTokenList 2.9.4 Safe passing of structured data 2.9.5 DOMStringMap 2.9.6 DOM feature strings 2.9.7 Exceptions 2.9.8 Garbage collection 3 Semantics and structure of HTML documents 3.1 Introduction 3.2 Documents 3.2.1 Documents in the DOM 3.2.2 Security 3.2.3 Resource metadata management 3.2.4 DOM tree accessors 3.3 Elements 3.3.1 Semantics 3.3.2 Elements in the DOM 3.3.3 Global attributes 3.3.3.1 The id attribute 3.3.3.2 The title attribute 3.3.3.3 The lang and xml:lang attributes 3.3.3.4 The xml:base attribute (XML only) 3.3.3.5 The dir attribute 3.3.3.6 The class attribute 3.3.3.7 The style attribute http://dev.w3.org/html5/spec/Overview.html 7 3/29/2009 5:38 PM 3.3.3.8 Embedding custom non-visible data 3.4 Content models 3.4.1 Kinds of content 3.4.1.1 Metadata content 3.4.1.2 Flow content 3.4.1.3 Sectioning content 3.4.1.4 Heading content 3.4.1.5 Phrasing content 3.4.1.6 Embedded content 3.4.1.7 Interactive content 3.4.2 Transparent content models 3.5 Paragraphs 3.6 APIs in HTML documents 3.7 Dynamic markup insertion 3.7.1 Controlling the input stream 3.7.2 document.write() 3.7.3 document.writeln() 3.7.4 innerHTML 3.7.5 outerHTML 3.7.6 insertAdjacentHTML() 4 The elements of HTML 4.1 The root element 4.1.1 The html element 4.2 Document metadata 4.2.1 The head element 4.2.2 The title element 4.2.3 The base element 4.2.4 The link element 4.2.5 The meta element 4.2.5.1 Standard metadata names 4.2.5.2 Other metadata names 4.2.5.3 Pragma directives 4.2.5.4 Other pragma directives 4.2.5.5 Specifying the document's character encoding 4.2.6 The style element 4.2.7 Styling 4.3 Scripting 4.3.1 The script element 4.3.1.1 Scripting languages 4.3.1.2 Inline documentation for external scripts 4.3.2 The noscript element 4.4 Sections 4.4.1 The body element 4.4.2 The section element 4.4.3 The nav element 4.4.4 The article element 4.4.5 The aside element 4.4.6 The h1, h2, h3, h4, h5, and h6 elements 4.4.7 The header element 4.4.8 The footer element 4.4.9 The address element http://dev.w3.org/html5/spec/Overview.html 8 3/29/2009 5:38 PM 4.4.10 Headings and sections 4.4.10.1 Creating an outline 4.4.10.2