24
TERAZ CZY ZA CHWILĘ?

HTML5 - now or later

Embed Size (px)

DESCRIPTION

Presentation from Krakspot Tech #4March 2011in Polish

Citation preview

Page 1: HTML5 - now or later

TERAZ CZY ZA CHWILĘ?

Page 2: HTML5 - now or later

<HTML>

+ Java.Script();

HTML5

Page 3: HTML5 - now or later

<HTML>

+ Java.Script();

~= HTML5CSS3

Page 4: HTML5 - now or later

<HTML> NEW DOCTYPE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

.

Page 5: HTML5 - now or later

<HTML> NEW DOCTYPE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!doctype html>

Page 6: HTML5 - now or later

<html> NEW DOCUMENT STRUCTURE

<!DOCTYPE html>

<meta charset="utf-8">

<title> Hello </title>

<p> sunshine </p>

Valid!

Page 7: HTML5 - now or later

<HTML> NEW SEMANTIC TAGS

<ARTICLE> <ASIDE> <SECTION> <hgroup> <NAV>

<FOOTER> <HEADER>

<figure> <figcaption>

<datalist> <menu> <command> <details> <summary>

<meter> <progress>

+ więcej

Page 8: HTML5 - now or later

<HTML> NEW WEB FORMS

<input type="text" required autofocus /> *

<input type="email" PLACEHOLDER="[email protected]" /> *

<input type="date" min="2010-08-14" max="2011-08-14"

value="2010-08-14"/>

<input type="range" min="0" max="50" value="10" />

* Input:invalid {...}

Page 9: HTML5 - now or later

<HTML> NEW WEB FORMS

<input type="search" results="10" placeholder="Search..." />

<input type="tel" placeholder="(555) 555-5555”pattern="^\(?\d{3}\)?[-\s]\d{3}[-\s]\d{4}.*?$" />

<input type="color" placeholder="e.g. #bbbbbb" />

<input type="number" step="1" min="-5" max="10" value="0" />

<input type= "URL" value="http://ohmy.com" />

Page 10: HTML5 - now or later

<HTML> NEW WEB FORMS

Page 11: HTML5 - now or later

<HTML> NEW WEB FORMS

email tel

number url

Page 12: HTML5 - now or later

<html> /jAVAsCRIPT(); NATIVE MEDIA

<video controls>

</video>

Page 13: HTML5 - now or later

<html> /jAVAsCRIPT(); NATIVE MEDIA

var video // video element

function playPause() {

if (video.paused || video.ended) {

video.play();

} else {

video.pause();

}

}

http://Video object API

Page 14: HTML5 - now or later

<html> /jAVAsCRIPT(); NATIVE MEDIA

<video controls>

<source src="vid.mp4">

<source src="vid.ogG">

<object data="vid.SWF">

<param name="movie" value="vid.SWF" />

</object>

</video>

Page 15: HTML5 - now or later

<html> /jAVAsCRIPT(); NATIVE MEDIA

<audio controls src="file.mp3">

<object data="file.mp3" >

<embed src="file.swf">

</object>

</audio>

Page 16: HTML5 - now or later

<html> /jAVAsCRIPT(); drawing

if (Modernizr.canvas) { // let's draw some shapes! } else { // no native canvas support available :( }

Nessie 150

Wendigo 150

Sasquatch 300

Chupacabra 100

Yeti 50

<CANVAS>

• Rysowanie w JS

• Wykresy

• Gry etc.

Page 17: HTML5 - now or later

jAVAsCRIPT(); New Events

WINDOW onerror

onhashchange

ononline / onoffline

onpagehide / onpageshow

(...)

HTML ELEMENTS ondrag / ondragstart / ondragend

ondrop

oninvalid

(...)

Page 18: HTML5 - now or later

jAVAsCRIPT(); Offline web

Web Storage (cookie na sterydach)

• 5 mb na DANE

• Trwałe

• Nie przesyłane na serwer (!)

Application cache

• <html manifest="/cache.manifest">

• CACHE / NETWORK / FALLBACK

Page 19: HTML5 - now or later

jAVAsCRIPT(); Communication

WebSocket

• Ws:// lub wss://

• Dupleks

• Bez nagłówków

• Bezpieczna?

Page 20: HTML5 - now or later

jAVAsCRIPT(); Communication

Web WorkerS (wielowątkowY JS)

Źródło: http://html5rocks.com

Page 21: HTML5 - now or later

No i jeszcze...

• history api

• Drag & drop

• Drag in

• Geolocation

• Microdata

• ARIA attributes

• Web SQL Database / IndexedDB

• (...)

Page 22: HTML5 - now or later

HTML5 TERAZ!Ale...

• Zadbaj o Wsteczną zgodność...

• ...I o Dobre Wersje alternatywne

• Nie uzależniaj kluczowych funkcjonalności...

• ...chyba, że piszesz dla konkretnej przeglądarki

Page 23: HTML5 - now or later

Modernizr.com

Detekcja funkcjonalności nie przeglądarki!

function supports_canvas() {

var d = document;

return !!d.createElement('canvas').getContext;

}

if (supports_canvas) {

// let's draw some shapes!

} else {

// no native canvas support available :(

}

Page 24: HTML5 - now or later

Dzięki piękne :)

[email protected]