Welcome to a new semi-regular column, "This Week in HTML 5," where I'll try to summarize the major activity in the ongoing standards process in the WHATWG and W3C HTML Working Group.
The biggest news is the birth of the Web Workers draft specification. Quoting the spec, "This specification defines an API that allows Web application authors to spawn background workers running scripts in parallel to their main page. This allows for thread-like operation with message-passing as the coordination mechanism." This is the standardization of the API that Google Gears pioneered last year. See also: initial Workers thread, announcement of new spec, response to Workers feedback.
Also notable this week: even more additions to the Requirements for providing text to act as an alternative for images. 4 new cases were added:
- A link containing nothing but an image
- A group of images that form a single larger image
- An image not intended for the user (such as a "web bug" tracking image)
- Text that has been rendered to a graphic for typographical effect
Additionally, the spec now tries to define what authors should do if they know they have an image but don't know what it is. Quoting again from the spec:
If the src
attribute is set and the alt
attribute is set to a string whose first character is a U+007B LEFT CURLY BRACKET character ({) and whose last character is a U+007D RIGHT CURLY BRACKET character (}), the image is a key part of the content, and there is no textual equivalent of the image available. The string consisting of all the characters between the first and the last character of the value of the alt
attribute gives the kind of image (e.g. photo, diagram, user-uploaded image). If that value is the empty string (i.e. the attribute is just "{}
"), then even the kind of image being shown is not known.
- If the image is available, the element represents the image specified by the src attribute.
- If the image is not available or if the user agent is not configured to display the image, then the user agent should display some sort of indicator that the image is not being rendered, and, if possible, provide to the user the information regarding the kind of image that is (as derived from the alt attribute).
See also: revision 1972, revision 1976, revision 1978, revision 1979, Images and alternate text.
Other interesting changes this week:
- revision 1951: define
window.top
- revision 1956: "User agents must not run executable code embedded in the image resource."
- revision 1958: more notes on what is a valid image (a surprisingly difficult question)
- revision 1965: allow
<a>
elements to straddle paragraphs
- revision 1998: define what happens when you set
onclick=''
on a document outside a Window
- revision 1999: define
javascript:
in Window-less environments
- revision 2001: define 'directionality' in terms of the
dir=''
attribute for cases where the 'direction'
property has no computed value
- revision 2002: define processing for the second argument to
getDataURL()
for image/jpeg
- revision 2004: specify how to handle transparent images in the
toDataURL()
method
- revision 2008: make patterns required in the
<canvas>
API
- revision 2016: when
<script type=''>
is given, it must match the type of the script, even if the script is Javascript
- revision 2019: remove
autosubmit=''
from the <menu>
element
Tune in next week for another exciting episode of "This Week in HTML 5."
Tags: thisweekinhtml5
Posted in Processing Model, Weekly Review, WHATWG | 21 Comments »
Boagworld is a web design and development podcast based in the UK. In today's episode, they interview me about HTML5. In it, we discuss the current state of HTML5, some of the new features that are currently, or are being implemented, and what we can expect in the future.
Posted in Events | Comments Off on Interview about HTML5 on Boagworld
If you’ve investigated how browsers parse HTML, you’ve probably used Hixie’s Live DOM Viewer to see what happens. Wouldn’t it be cool, though, if you could experiment with the HTML5 parsing algorithm in the same UI? Well, now you can.
I was looking for a way to experiment with document.write()
in the code base of the Validator.nu HTML Parser and I was looking for a way to let people see the parse tree output of the HTML5 parsing algorithm more easily. Instead of writing a test harness fully in Java, I thought it would be better to use the Live DOM Viewer and a browser engine as the test harness. The good news is that Google Web Toolkit makes it possible to put these pieces together, and the trunk of the Validator.nu HTML parser now comes with a document.write()
-aware tokenizer driver and a tree builder subclass for GWT.
The bad news is that the Java-to-JavaScript compiler of GWT has a bug that blocks me from putting the result online as JavaScript. The Hosted Mode of GWT, works, though.
Here’s how you can run the Validator.nu HTML Parser in the Live DOM Viewer locally in the Hosted Mode of GWT (on Mac or Linux):
- Check out the source: svn co http://svn.versiondude.net/whattf/htmlparser/trunk/ htmlparser
- Download and untar GWT 1.5 RC1
- On Linux, install libstdc++5 and a JDK (Ubuntu's OpenJDK-based package worked for me).
- Edit the paths in
HtmlParser-shell
(Mac) or HtmlParser-linux
(Linux) to point to the location of GWT.
- Run
HtmlParser-shell
(Mac) or HtmlParser-linux
(Linux)
Known problems:
- The Linux version of GWT runs an outdated version of Gecko, and the rendered view doesn't work. The DOM view does.
- The Mac version of GWT runs a Web Inspector-enabled version of WebKit, but SVG does not draw.
document.write()
semantics are right only for inline scripts.
- Copying and pasting using keyboard shortcuts doesn’t work. (Use the context menu.)
- On Linux, GTW prints a lot of harmless warnings about not finding annotations. (I don’t know why that happens. The annotations should be among translatables.)
- Gecko (used by GTW on Linux) doesn't allow the creation of xmlns attributes in no namespace, so things stop working if you try to put an attribute called
xmlns
on HTML elements.
- The DOM view on Linux doesn't report names with colons in them per the HTML5 spec.
(Aside: This code could have applicability beyond testing the parser. If the compiler bug were fixed or worked around, a script could document.write()
a math
element and an svg
element to sniff if they are parsed according to HTML5 and if they aren't, move aside load event handlers, document.write()
<plaintext style='display:none'>
, wait until DOMContentLoaded
, load the the already created html
, head
and body
elements onto the tree builder stack and head pointer of the HTML5 parser to and reparse the content of the plaintext element as HTML5 and call the load event handlers. See Philip Taylor’s proof of concept with S-expressions.)
Posted in Syntax | 1 Comment »
Lachlan Hunt and I recently gave a presentation entitled Getting Your Hands Dirty with HTML5 at the @media 2008 conference in London. The audience was mainly front-end developers; the kind of people who are using HTML to make a living, so it was a great chance to get the message out about some of the new features that have been under development.
The talk covered the Design Principles under which HTML5 is being developed, how some of the features of HTML5 can be used to enhance common web sites, and how people can get involved with the development of HTML5.
The presentation seemed to go reasonably well, especially given that we had not met till the morning of the talk although we did have fewer demos than I would have liked, both due to technical problems in the talk and a lack of time to prepare. So, for those who were at the talk (as well as those who were not), here are a somewhat random collection of demos of the HTML5 features we mentioned:
If anyone who saw the presentation is reading this and would like to provide constructive criticism on the talk, I would really appreciate it; giving talks is fun so it would be nice to get better at it 🙂
Posted in WHATWG | Comments Off on HTML5 Presentation at @media 2008
Since HTML5 is a large specification Ian and I, being encouraged by Dan Connolly from the W3C, wrote an introductory document to the offline Web application features in HTML5 — Offline Web Applications — which the W3C published earlier today. In summarized form, it explains the SQL API, the offline application cache API, and some of the related APIs, such as online
and offline
events.
Tags: W3C
Posted in W3C | 7 Comments »