From http://www.w3schools.com/html/html5_intro.asp :
Even though everything says that utf-8 is the "default" character set,
Firefox complains unless pages explicitly have the meta line:
Misc
Cookies -> Local storage
Elements: http://www.w3schools.com/html/html5_new_elements.asp
Convention is LC tag and element names.
datalist is just a type-ahead lookup for text fields.
The s within datalist are very different from s.
No separate value and label.
s must have text content for the label.
s have no text content and do not close.
8 New semantic block elements (to construct a document outline):
header, section, footer, aside, nav, main, article, figure
[What about details, figcaption, mark, summary, time?]
menuitem, details, summary, main no good in IE +.
(For old browsers, need CSS so interpreted as block instead of inline,
BUT since IE < 9 does not allow styling unknown els, need to use full
work-around "the shive").
section should contain a heading, but can nest arbitrarily
article should be self-contained, but can nest arbitrarily
captioned image =
before to position it above; and vice versa.
(page/head) title is required
new is within body
not supported in IE.
New form control attributes like number, date, time, calendar, and range.
New graphic elements: and .
(0,0) is at top left corner.
canvas is for JavaScript drawing. Poor for text drawing but can do.
High perf. Can be saved to .png or .jpg.
Draw with context: canvEl.getContext("2d");
GOTCHA! Use width and height attrs, NOT CSS, to size the canvas!
svg is for XML drawing. The svg objects are available to JS.
vectors are located by cx/cy of their centers.
Color with either stroke and fill vector attrs or vector styles.
Styles may be set inline or with regular CSS selectors.
New multimedia elements: , , (and nested elements)
Do specify size for video panel (by attr, not CSS).
Apparently just width works.
New custom elements allowed by syntax
(still inline by default; you will normally want to add CSS).
Meter (guage), display-only, not supported in IE.
Input elements: 13 new input types; 16 new attrs.
APIs:
HTML Geolocation With file: URLs doesn't work with Chrome. Works with FF.
Error-handling callback doesn't seem to fire with FF.
HTML Drag and Drop
Default behavior is paste the transfer data into allowing reciever.
Default allowing receivers are text editors, HTML form fields, browser
URL window.
For URL, add a "text/uri-list" for same data before the "text-plain".
To transfer app-specific data, use a custom data type.
Custom receivers must ALLOW via 'event.preventDefault()' for both
ondrop= and ondragover= handlers. The ondrop handler receives data:
ondrop='event.preventDefault(); d = event.dataTransfer.getData(typ);'
event.dataTransfer.getData(type) is always a String (so need to convert)
HTML Local Storage
Just use localStorage and sessionStorage maps.
Remove entries with *Storage.removeItem("key");
With file: URLs, localStorage saves are tab-specific.
LOCAL STORAGE NOT WORKING even across browser tabs, for me,
even when using an HTTP server with a FQHN URL.
HTML Application Cache
A manifest text file with custom syntax, normal suffix ".appcache".
Server must service it with media type text/cache-manifest for it to work.
NOT only for offline browsing.
Specified resources will only be downloaded when the *.appcache file
changes, regardless if he resource has changed or not.
HTML Web Workers
Default closure object is not 'window', so have no access to window, document, parent,
but the onmessage listener (function) that you define does have closure of window.
The provided listener listens until you w.terminate().
Worker code calls postMessage(messageTextData);
Worker code must be in an external file. Booted with:
var worker = new Worker("file.js");
Can't re-use the file until you: worker = undefined;
HTML SSE
Not supported by IE.
Designed extremely analogously to Web Workers.
URL service must return text/event-stream content
beginning with "data: " ending with "\n\n".
Internal occurrences of "\ndata: " will be removed.
Contrary to w3schools, must register like
source.addEventListener("message|open|error"), function(event) {...
Use source.close(), not source.terminate();
Automatically reconnects to the service after disconnects.
Can check e.origin (in addition to e.data).
Server can specify event types, and client side can listen for
specific event types.
Removed elements:
acronym
applet
basefont
big
center
dir
font
frame
frameset
noframes
strike
tt
Legacy browser support
Blockify the 8 new semantic els.
JS "document.createElement(x);" for all new and custom elements.
"the shiv" workaround required for IE < 9 due to inability to style unknown elements:
Must be placed inside (in reality, BEFORE body is effectively in head).
image best practices
Always specify size. Do specify size for video panel (by attr or CSS).
Always specify alt text (alt="...").
other best practices
spaces around equals signs is allowed (but ugly)
html and body not required (but preferred)
no tabs; indent with 2 spaces
omit and leverage that pre-body == inside head
Type attrs unnecessary for includes
Vanilla JavaScript bootstrapping:
Multi-media
Video
Supported Video formats: MP4, Ogg, WebM,
but only MP4 supported by all HTML5 browsers.
No MPEG (though MP3 audio is), AVI, WMV, QuickTime, RealVideo support.
Flash requires browser support.
Mime-types for source elements: video/mp4, video/webm, video/ogg
src attr not well supported, so use source element(s).
autoplay and controls apparently incompatible with one another.
autoplay has no effect on portable devices
Javascript has full playback control.
Your browser does not support HTML5 video.
Audio
No support: MIDI, RealAudio, WMA, AAC
Supported: WAV, Ogg, MP3, MP4
HTML and CSS Code Validation. Enter your URL at
http://www.w3schools.com/website/web_validate.asp
Forms
Supported input types: http://www.w3schools.com/tags/att_input_type.asp
(type still defaults to "text").
Input validation seems to always occur only upon submit.
Does not work with safari
title attr value used for both tooltip + syntax error message
Impossible to specify a modifier (like case-insensitive)
Test only runs upon submit
pattern must match entire string. It's like Java String.match().
type "number" renders with a spinner for Chrome and FF, not IE 11.
"number" is for integers (negatives supported)
Does not work with Safari
PORTABLE types (*=lacking only Safari): email*, number, range, url* + all HTML4
IE 11 displays range as text field.
Support problems for input types:
type "datetime" deprecated (for "datetime-local")
color
date
datetime
datetime-local
email only lacking in Safari
month
search
tel
time
url only lacking in Safari
week
Type "image" is just a submit button with an image.
New input attributes
Most just allow for input-specific overrides of the form attributes.
autocomplete
novalidate
autofocus (for one input)
list for
It remains a text list and allows arbitrary text entry. Not a select!
multiple for types email, file
pattern
height, width for type image
pattern
placeholder
required
min,max,step
readonly seems to have no effect on input types checkbox, radio, submit.
(disabled works great)
ID requirements relaxed:
an id must contain at least one character and may not contain any space characters.
To use a new tag name in IE, must run document.createElement("X") (just disregard the generated EL).
There is no custom element feature for HTML5
I think notes in here about IE limitations for range and number are wrong.
progress tag styling is difficult because it's so browser-dependent.
Default colors:
Chrome blue over light gray
IE dark cyan over gray
FF green over lightish gray
To set a tooltip, do set title attr.
The body value is (IIRC) used for browsers that can't render the progress meter.
IE styles as completely unstyled div rectangles.
FF styles as slightly styled div rectangles.
Chrome styles fancy. But to customize any styling you must disable the
custom styling and go to plain rectangles first.