HTML and CSS Reference
In-Depth Information
It is interesting that many developers are quite okay with the use of innerHTML but are
quick to deride the use of JavaScript's eval() statement. In many ways, these are the same
concepts: the former provides direct access to the markup parser and the latter provides
direct access to the JavaScript interpreter. Regardless of the consistency of Web developers'
thinking patterns, the codification of innerHTML is quite a welcome change.
The embrace of common practices by HTML5 isn't limited to innerHTML ; the specification
supports all sorts of features, such as designMode features that allow for browser-based
WYSIWYG editing, commonly used DOM workarounds like insertAdjacentHTML() ,
emerging DOM methods like getElementsByClassName() , more-esoteric DOM
specifications like ranges and selections, and more.
The specification also provides APIs for what it introduces. We explored just such an
API earlier in the chapter when we experimented with canvas scripting. Similarly, elements
like audio and video expose a number of properties such as volume and methods such as
play() .
There is much to be discovered when reading the HTML5 specification closely. Consider,
for example, how browsers handle runaway script code. There really is nothing online that
defines how or when this is done, but the HTML5 specification actually starts to address
such problems (section
User agents may impose resource limitations on scripts, for example, CPU quotas,
memory limits, total execution time limits, or bandwidth limitations. When a
script exceeds a limit, the user agent may either throw a QUOTA_EXCEEDED_
ERR exception, abort the script without an exception, prompt the user, or throttle
script execution.
If you take the time to read the specification, you will find many passages such as this
that offer hope that someday troubling corner cases in Web development will be reduced or
even eliminated. However, you might also get a sense that the aims of the specification are
a bit too grand. You can find bits and pieces of half-baked ideas about undo-redo handling;
subtle hints about important architectural changes, such as the management of history for
supporting Ajax applications; discussion of offline features and storage schemes; and
documentation of a variety of communication schemes, from interframe message posting to
full-blown Web Socket communication. In some cases, these diversion APIs will spawn their
own documents, but in other cases they just clutter the specification. The critics really do
have a point here.
Major HTML5 Themes
As we wind down the chapter, we need to take a look at some of the major themes of HTML5.
These are deep issues that you will encounter over and over again in the Web development
community. These are presented mostly to spur your thinking rather than to offer a definitive
answer, because HTML5 is quite a moving target.
HTML5 Today or Tomorrow?
The simple question that you must have about HTML5 is, can I use it yet? The answer is
yes. You can embrace the future just by adopting the simple <!DOCTYPE html> statement.
Of course, that isn't very interesting, so your question really is, can I use any of the new
Search WWH ::

Custom Search