2012-04-28

HTML5 strict for Dojo Toolkit pages and templates

While there are many opinions on whether to use HTML5 , strict, XML syntax, etc. I would like to highlight my own reasons.

Requirements:

  • entry page to have most cross-browser compatible (with predictable behavior) mode.
  • widgets templates to have most strict syntax enforced as by HTML validator as by functional and visual tests.
  • widgets templates to be tested against different doctypes and modes to support SDK requirement of customizing and extending UI by user.

Pages

First 2 requirements are orthogonal to each other and have different outcomes Primary landing pages should have
  • doctype as in HTML5
  • html with XHTML namespace
  • lang attribute( to be mirrored by metadata tag )
Do NOT include the processing instructions for XHTML.
<!DOCTYPE html>
<html
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:lang='en'
  ><head>
 <meta charset="UTF-8" />
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Widget templates

For each modulle template XHTML 1.1 is more suitable due to higher standard compliance reasons.

This DTD is equal to XHTML 1.0 Strict, but allows you to add modules (for example to provide ruby support for East-Asian languages). Note that processing instruction INCLUDES XHTML DTD

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:lang='en'
  >...

Refs:
http://en.wikipedia.org/wiki/Doctype

Input appreciated.