Is HTML 5 by Apple really HTML 5?

(Ta notka jest także dostępna po polsku)

Apple recently released a number of demos, which they call HTML 5 demos. In this post, I’d like to analyze whether these demos are really HTML 5 or not. I am not going into ideological stuff here (but, to be honest, I do agree with Chris Blizzard’s point of view) – I’m going to check only the technological side of these demo pages.

One thing before we begin. Please note that the “long story short” sentences at the end of each paragraph relate to what I think is really demoed on each page, not to the formal presence of HTML 5 tags. For example, if a page uses HTML 5 section tags (and most of them do), but the demo itself is actually about style transitions, I do not consider it an HTML 5 demo. With this in mind, let’s start.

Video – indeed uses HTML 5 <video> tag, embedding an h.264 video file. Perspective and masking effects are not part of HTML 5, they are possible thanks to Apple’s experimental extensions to the CSS standard. So, this is indeed an HTML 5 demo, but not all the cool stuff here is actually HTML 5.
Long story short, HTML 5: yes, CSS 3: not really, Apple’s proprietary CSS extensions: yes.

Typography – HTML 5 has nothing to do with font embedding. Font embedding is standard CSS 2 (though only recently widely implemented by browser vendors). Horizontal slider is made out of plain old HTML 4 elements (mainly divs), instead of standard HTML 5 <input type=range> element, which is actually supported by Safari. Transparency works thanks to the widely supported CSS 3 Color Module opacity property. Rotation is powered by Apple’s experimental -webkit-transform property, which is actually supported by other browser vendors with their own prefixes (-moz-transform in Firefox 3.6 and -o-transform in latest Operas). Text shadow is applied through the text-shadow property from CSS 3 Text Module. It is also supported by Mozilla and Opera. No HTML 5 here other than <nav> and <section> elements, used throughout the demo site (though, there are lots of HTML4 <div>s there, too). You could make a basically identical page with plain old HTML 4, all the good stuff is, in fact, CSS 3 or experimental additions to CSS 3.
Long story short, HTML 5: not really, CSS 3: a bit, CSS 2: yes, Apple’s proprietary CSS extensions: yes.

Gallery – the only HTML 5 elements here, apart from <nav> and <section>, are <figure> elements, containg the image and prev/next buttons. All the cool stuff is actually made of Apple’s experimental CSS transforms and transitions (other browsers do support some or most of the same transforms and transitions with different vendor prefixes, i.e. Opera has -o-transition instead of -webkit-transition). While cool, these things are not standard yet, and never will be part of any HTML version – as they are extensions to CSS.
Long story short, HTML 5: a bit, CSS 3: no, Apple’s proprietary CSS extensions: yes.

Transitions – are all about the same above-mentioned CSS transforms and transitions. HTML 5 is only used in the navigation part (the links starting off each transition are inside a <section> element, and the header is indeed an HTML 5 <header> element). The real part of the demo – the images that are transformed through CSS, are in plain old <div>s, though. All the coolness thanks to proprietary extensions to CSS.
Long story short, HTML 5: not really, CSS 3: no, Apple’s proprietary CSS extensions: yes.

Audio – a real HTML 5 demo, uses <audio> and <canvas> HTML 5 elements. The song is in the proprietary and patent-encumbered MP4 format, though.
Long story short, HTML 5: yes. Whoohoo!

360° – a JavaScript script cycles through many images of the iPod touches as you move your mouse. Nicely done, but the only thing here that was not possible a few years ago is touchscreen compatibility thanks to Apple’s proprietary events souch as ontouchstart. If you ignore the touchscreen-related events, you can make an identical demo even in piece-of-crap browsers like IE 6 with little effort. So, as the touch events are the only really new thing here, it seems that this is in fact a demonstration of these iPod/iPad/iPhone-related touch events, not of any HTML 5 features.
Long story short, HTML 5: no, CSS 3: no, Apple’s proprietary events: yes.

VR – lots of Apple’s proprietary experimental CSS transforms and transitions shown here plus some JavaScript, but not much of HTML 5.
Long story short, HTML 5: not really, CSS 3: no, Apple’s proprietary CSS extensions: yes.

Apple says:

The demos […] show how the latest version of Apple’s Safari web browser, new Macs, and new Apple mobile devices all support the capabilities of HTML5, CSS3, and JavaScript.

As you can see, with some exceptions (video/audio and canvas) and some marginal features outside of the core of each demo (navigation and sectioning), the real objective of these demos is to show Apple proprietary features, mostly CSS extensions. To be fair to the Cupertino company, some of them are pushed by Apple for standarization in the W3C, which is a good thing. Still, it does not make them standards at this moment, and once they become standards, they might look a bit or a lot diffrent.

There’s nothing inherently wrong in the demos themselves (and, as always with Apple, they are cool eye candy), but calling them “HTML 5” – while they do not show a lot of real HTML 5 features – and “standards” – while they’re mostly Apple’s proprietary non-standard extensions – seems to me slightly insincere. What is shown here is actually the great potential of the WebKit rendering engine. If they called it “Apple WebKit demos”, that would be correct and honest.

Post Scriptum for buzzword lovers: Of course, some people (like PPK) are trying to make a buzzword out of “HTML 5”, with meaning shifted from “HTML – the markup language and related APIs” to “all the cool new stuff without Flash”. If you’re one of those people, feel free to agree with Apple on this, and disagree with me.

PS #2. Am I an Apple hater? I wrote this on my MacBook… ;-)

Ile HTML 5 w HTML 5 – co właściwie pokazało Apple?

(This post is also available in English)

Apple udostępniło ostatnio kilka przykładów, które nazywa “demonstracjami możliwości HTML 5”. W tej notce chciałbym sprawdzić, czy faktycznie demonstrowane są tutaj możliwości HTML 5, czy może czegoś innego. Nie zamierzam tu zagłębiać się w ideologię (choć, szczerze mówiąc, całkowicie zgadzam się tutaj z Chrisem Blizzardem) – chcę się skupić wyłącznie na kwestiach technicznych.

Jeden drobiazg, zanim zaczniemy. Każde podsumowujące zdanie “krótko mówiąc” dotyczy tego, co moim zdaniem jest demonstrowane na danej stronie, a nie formalnej obecności znaczników HTML 5 w kodzie. Przykładowo, jeśli strona stosuje znaczniki sekcji HTML 5 (a większość z nich to robi), ale demo dotyczy tak naprawdę przejść (tranzycji) stylów, nie uważam jej za demo HTML 5. Mając to na uwadze – zacznijmy.

Video – faktycznie używa znacznika <video> HTML 5 do osadzenia pliku wideo w formacie h.264. Natomiast perspektywa i efekty maskowania nie są częścią HTML 5 – umożliwiają je eksperymentalne rozszerzenia CSS Apple’a. Tak więc jest to demo HTML 5, ale nie wszystkie fajne rzeczy w nim zawarte są częścią HTML 5.
Krótko mówiąc, HTML 5: tak, CSS 3: nie bardzo, rozszerzenia CSS Apple’a: tak.

Typography – HTML 5 nie ma nic wspólnego z osadzaniem czcionek. Osadzanie czcionek zostało opisane w specyfikacji CSS 2 (choć dopiero od niedawna jest to szerzej obsługiwane przez przeglądarki). Suwak poziomy został tutaj zbudowany ze starych elementów HTML 4 (głównie divów), nie wykorzystano tu standardowego elementu <input type=range> HTML 5, który jest obsługiwany przez Safari.
Przezroczystość działa dzięki szeroko dziś obsługiwanej własności opacity z CSS 3 Color Module. Rotacje umożliwia eksperymentalna własność CSS Apple’a -webkit-transform, która tak naprawdę ma swoje odpowiedniki w innych przeglądarkach – z innymi prefiksami producenta (-moz-transform w Firefoksie 3.6 i -o-transform w nowych Operach). Cień pod tekstem dołożony został przez własność text-shadow z CSS 3 Text Module. Jest to także obsługiwane przez Mozillę i Operę. Z wyjątkiem elementów <nav> i <section>, stosowanych we wszystkich stronach z tej grupy, nie ma tu nic z HTML 5 (mamy za to sporo <div>-ów z HTML 4). Można więc zrobić stronę wyglądającą i zachowującą się identycznie w starym dobrym HTML 4. Wszystkie bajery tutaj to tak naprawdę CSS 3 lub eksperymentalne rozszerzenia CSS Apple’a.
Krótko mówiąc, HTML 5: nie bardzo, CSS 3: trochę, CSS 2: tak, rozszerzenia CSS Apple’a: tak.

Gallery – poza <nav> i <section> z HTML 5 mamy tu tylko elementy <figure>, zawierające obrazki i przyciski prev/next. Ponownie, wszystkie bajery zapewniane są przez eksperymentalne rozszerzenia CSS Apple’a – transformacje (transforms) i efekty przejścia (transitions). Inne przeglądarki również to obsługują, ale z innymi prefiksami w nazwie, tj. Opera ma np. -o-transition w miejsce -webkit-transition. Fajnie to wygląda, ale nie jest to jeszcze ustandaryzowane i nigdy nie będzie częścią żadnej wersji HTML – jako że to rozszerzenia CSS.
Krótko mówiąc, HTML 5: trochę, CSS 3: nie, rozszerzenia CSS Apple’a: tak.

Transitions – to demko również dotyczy przejść i transformacji. HTML 5 używany jest tylko do nawigacji (linki odpalające przejścia są zawarte w elemencie <section>, a nagłówek – w HTML 5 <header>). Istotna część demonstracji – obrazki przekształcane przez CSS – siedzą w starych, dobrych <div>-ach. Wszystkie bajery pochodzą z rozszerzeń CSS Apple’a.
Krótko mówiąc, HTML 5: trochę, CSS 3: nie, rozszerzenia CSS Apple’a: tak.

Audio – w końcu prawdziwe demo HTML 5, używające elementów <audio> i <canvas> z HTML 5. Piosenka jest we własnościowym formacie MP4.
Krótko mówiąc, HTML 5: tak. Hurra!

360° – skrypt w języku JavaScript przełącza pomiędzy kolejnymi zdjęciami iPodów touch podczas przeciągania myszą. Fajnie zrobione, ale jedyna nowa rzecz tutaj, której nie można było zrobić dawniej, to zgodność z ekranami dotykowymi dzięki zdarzeniom takm jak ontouchstart, które są niestandardowym rozszerzeniem DOM Apple’a. Pomijając zdarzenia dla ekranów dotykowych, można przy niewielkim wysiłku zrobić identyczne demo działające nawet w badziewnych przeglądarkach jak IE 6. Jako że jedyną nowością są tu właśnie te zdarzenia dotykowe dla iPoda/iPada/iPhone’a, wydaje się, że właśnie ich pokazanie było celem tej demonstracji, a nie HTML 5.
Krótko mówiąc, HTML 5: nie, CSS 3: nie, własne zdarzenia Apple’a: tak.

VR – wiele różnych transformacji i przejść z eksperymentalnych rozszerzeń CSS Apple’a plus trochę JavaScriptu, ale niespecjalnie dużo HTML 5.
Krótko mówiąc, HTML 5: nie bardzo, CSS 3: nie, rozszerzenia CSS Apple’a: tak.

Apple mówi:

Te demonstracje […] pokazują, w jaki sposób najnowsza wersja przeglądarki Safari Apple’a, nowe Macintoshe i nowe urządzenia przenośne Apple’a obsługują funkcjonalności HTML5, CSS3 i JavaScriptu.

Jak widać, z kilkoma wyjątkami (video/audio i canvas) i mniej istotnymi częściami poza sercem każdego demo (nawigacja i sekcje), głównym ich celem wydaje się tutaj pokazanie własnych, niestandardowych funkcjonalności Apple’a, głównie rozszerzeń CSS. Owszem, część z nich Apple przekazało do W3C i są one obecnie standaryzowane, co jest istotnym plusem. Niemniej jednak, nie są one standardem na chwilę obecną, a kiedy już zostaną ustandaryzowane, mogą wyglądać nieco lub bardzo inaczej.

W samych demkach nie ma nic złego (i, jak zawsze u Apple’a, wyglądają super), ale nazywanie ich “demonstracjami HTML 5” – kiedy nie pokazują wiele z HTML 5 – i “demonstracjami standardów”, podczas gdy prezentują głównie niestandardowe rozszerzenia Apple’a – wydaje mi się trochę nieuczciwe. Co tutaj widać, to wielki potencjał silnika WebKit. Określenie tych stron “Demonstracją możliwości Apple WebKit” byłoby więc bardziej zgodne z rzeczywistością.

PS. Oczywiście, niektórzy (jak PPK) chcą uczynić z “HTML 5” tzw. buzzword, który nie ma znaczyć już “HTML – język znakowania oraz powiązane API”, tylko “wszystkie fajne nowe rzeczy bez Flasha”. Jeśli do nich należysz, masz prawo zgodzić się tutaj z Apple, a nie ze mną.

PS #2. Czy jestem wrogiem Apple? Napisałem tę notkę na MacBooku… ;-)