HTML and CSS Reference
In-Depth Information
unfortunately failed. However, to be fair, past HTML specifications have not adequately
considered the context of markup usage. The reality is that Web development technologies
must live together, so it makes sense that HTML5 discusses the intersection between HTML
and other technologies. This section provides a brief overview of some of the interesting
aspects of HTML5 that are not limited to markup.
defer Attribute
HTML5 standardizes the defer attribute, long supported by Internet Explorer, to help
improve page rendering. In the presence of a defer attribute on a script element, or
defer="defer" in the case of markup using XML-like syntax, a supporting browser
should delay executing, and even loading (in the case of linked scripts) to a future time.
As a simple example, the following are two inline scripts, the first with a defer attribute
and the second without:
<script defer type="text/javascript" defer>
alert("Deferred Script");
<script type="text/javascript">
alert("Immediate Script ");
In supporting browsers, the first script would actually fire after the second. This
postponing of execution should also hold for external files and DOM inserted scripts as
well. Unfortunately, at the time of this edition's writing, the actual execution pattern for
deferred scripts is variable in browsers:
No defer
defer supported
but varies
HTML, JavaScript, and the DOM Renewed
The W3C's DOM specifications ( provide the interface between
(X)HTML and JavaScript. These APIs allow Web developers to programmatically change
the very markup and style of Web pages, creating what is often dubbed dynamic HTML
(DHTML). While JavaScript hooks to markup and style are widely used, many browser-
specific features have been introduced and many workarounds have been invented because
the specifications have stayed static for a number of years. HTML5 codifies many of these
Search WWH ::

Custom Search