HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not...

58
HTML5 Overview Michael(tm) Smith W3C HTML WG Co-Chair W3C Web Apps WG Co-Team Contact

Transcript of HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not...

Page 1: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

HTML5Overview

Michael(tm) Smith

W3C HTML WG Co-ChairW3C Web Apps WG Co-Team Contact

www.princexml.com
Prince 6.0 Personal Edition
This document was created with Prince, a great way of getting web content onto paper.
Page 2: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

[email protected]

with extensive borrowings from Anne van Kesteren and Simon Pieters

Page 3: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Full title

“HTML5: A vocabulary and associated APIsfor HTML and XHTML”

original title: “Web Applications 1.0”

Page 4: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Focuses on Web Applications• 10 years since HTML4; in the mean

time, among many other things, XHR/Ajax happened

• what is now the W3C HTML5 draft hasbeen in development since 2004 (by

Page 5: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

WHATWG for 3 years before currentHTML WG even existed)

Page 6: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

HTML as an abstract language

(re)defines HTML as an abstract language

• Defined in terms of the DOM• HTML serialization: text/html• XML serialization: any XML MIME

Page 7: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema
Page 8: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Other serializations possible?

S-expressions, … ?

Page 9: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

What does HTML5 not do?

Page 10: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

HTML5 does not treatHTML as SGML

Page 11: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

HTML5 does not use DTDs

Page 12: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

True: Some tools do handleHTML as SGML• W3C Markup Validation service does

process HTML as SGML• http://validator.w3.org/

Page 13: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

But: Browsers don’t processHTML as SGML

Browsers do not have SGML parsers —they don’t check DTDs or follow otherSGML parsing rules.

Instead, they use custom parsers builtspecifically for parsing HTML

Page 14: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

HTML5 does specify anXML serialization ofHTML…

Page 15: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

…but HTML5 does notrestrict HTML to only a(well-formed) XML-basedserialization

Page 16: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

text/html: attribute syntax

All of the examples below are conformant HTML

• Well-formed XML: <inputdisabled="disabled">

• Empty attribute: <input disabled>• Without quotes: <input value=yes>• Single quotes: <input type='checkbox'>• Double quotes: <input name="be evil">

Page 17: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

The HTML DOCTYPE<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!doctype html>

Page 18: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Declaring a character encoding<metahttp-equiv="Content-Type"content="text/html;

charset=utf-8"><meta charset="utf-8">

Page 19: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Why not restrict HTML towell-formed XML (that is,XHTML)?

Page 20: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

XML requires draconianerror handling for allcontent served asXHTML…

Page 21: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

…which means that forany XHTML page thatcontains even one singleminor error…

Page 22: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

…a browser must fail todisplay the page at all…

Page 23: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

…and because the vastmajority of HTML on theWeb is not well-formedXML…

Page 24: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

…we need tointeroperably handle that“real world” (or “tagsoup”) HTML

Page 25: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Precisely specifying parsing of“real world” HTML

HTML5 includes a precise algorithm forexactly how conformant UAs/browsersmust parse HTML (an algorithm thatclosely matches existing browserimplementations)…

Page 26: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

…including parsing ofHTML that may not bewell-formed XML and isserved up as text/html

Page 27: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

non-browser HTML5 parsers• html5lib (Python, Ruby)• the Validator.nu parser (Java)• C++ library?• can be plugged into other applications

in the same way that XML parsers canbe

Page 28: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Formal spec for error handling

Recognizing that many authors producenon-conformant documents and that appsneed to deal with such documents, HTML5precisely specifies handling of markuperrors and other classes of errors — sothat such errors will be handled in aninteroperable way across UAs/browsers

Page 29: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

In other words

We need to specify error handlingbehavior to ensure interoperability “evenin the face of documents that do notcomply to the letter of the specifications”.

see http://www.whatwg.org/news/start

Page 30: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

And in yet other words

Authors will write invalid contentregardless of what we spec. So the specstates “what authors must not do, andthen tells implementors what they mustdo when an author does it anyway”.

see http://esw.w3.org/topic/HTML/DraconianErrorHandling and Ian Hickson’s “Errorhandling and Web language design”, http://ln.hixie.ch/?start=1074730186

Page 31: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

HTML5 conformance checking• html5.validator.nu (X)HTML5 Validator• does not use DTDs• RELAX NG & Schematron for schema

validation• other means of non-schema checking• a RESTful Web service API

Page 32: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

So what’s new/different inHTML5?

Page 33: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Support for de facto standards• innerHTML• Window object• others…

Page 34: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Web Forms 2.0• Client-side validation without script• New form controls in browsers

Page 35: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

<input>

• type=email:• type=url:• type=date:• type=range: 0• required:

Page 36: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

New elements…

Page 37: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

New elements for betterdocument structure…

Page 38: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

<section>

Page 39: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

<nav>

Page 40: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

<article>

Page 41: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

<aside>

Page 42: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

<header>

Page 43: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

<footer>

Page 44: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

canvas element: img, butscripted…

Page 45: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Used on Y! Pipes…

Page 46: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

<canvas width="150" height="200" id="demo"><!-- fallback content here --></canvas>

<script type="text/javascript">var canvas = document.getElementById("demo"),

context = canvas.getContext("2d")context.fillStyle = "lime"context.fillRect(0, 0, 150, 200)</script>

Page 47: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

video and audio elements• Extensive scripting API for loading and

playing media resources

Page 48: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Along with new elements,we also have new APIs

Page 49: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Cross-document messaging• postMessage(): allows docs to

communicate w/ each other acrossdomains, without enabling cross-sitescripting attacks

• implemented in Moz, Webkit, Opera, &IE8

Page 50: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

New APIs: Another example

Persistent client-side data storage

• Client-side session and persistentstorage of name/value pairs

• Gears-like client-side SQL databasestorage

Page 51: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Webkit implementation ofHTML5 client-side SQL databaseAPI• Example/demo is at http://webkit.org/

misc/DatabaseExample.html• Requires Safari 3.1 or latest nightly

WebKit

Page 52: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Summary: How Will HTML5help?• Bring new features• Make things better for Web developers• Giving choice to users

Page 53: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Making things better fordevelopers• Precise, unambiguous spec makes

interoperable implementation possible(less need for UA sniffing and multiplecode paths)

Page 54: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

• Enables (for example) Ajax to actuallywork the way it is supposed to — thatis, interoperably

• Development of Web apps withfeatures on par with Flash, Silverlight,and native applications

Page 55: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Giving choice to users

Standards-based Web applications workthe same across browsers, so users arenot locked into using any particularproduct from any particular vendor. Usersget to choose.

Page 56: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

How can you help HTML5?• Participate in group (public-html

mailing list)• Something missing? Write a spec

proposal!• Volunteer as additional editor for

(re)writing/editing a part of the spec

Page 57: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

• Write and contribute test cases• …

Page 58: HTML5 - w3.org · HTML5 conformance checking • html5.validator.nu (X)HTML5 Validator • does not use DTDs • RELAX NG & Schematron for schema validation • other means of non-schema

Questions? Comments?