Evangelism/Firefox3.5/35Days/Articles/Defer on script elements: Difference between revisions

Jump to navigation Jump to search
m
Line 3: Line 3:
== '''<font style="color: red;">WORK IN PROGRESS</font>''' <tt>defer</tt> attribute for the  <tt>&lt;script&gt;</tt>  element ==
== '''<font style="color: red;">WORK IN PROGRESS</font>''' <tt>defer</tt> attribute for the  <tt>&lt;script&gt;</tt>  element ==


In HTML, the <tt>script</tt> element allows authors to include dynamic script in their documents. The <tt>[http://www.w3.org/TR/html5/semantics.html#attr-script-defer defer]</tt> attribute is boolean attribute that indicate how the script should be executed. It was first introduced in Internet Explorer 4, and added in the [http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.1 HTML 4 specification].<br>
In HTML, the <tt>script</tt> element allows authors to include dynamic script in their documents. The <tt>[http://www.w3.org/TR/html5/semantics.html#attr-script-defer defer]</tt> attribute is boolean attribute that indicate how the script should be executed. It was first introduced in Internet Explorer 4, and added in the [http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.1 HTML 4 specification].
 
If the <tt>defer</tt> attribute is present, then the script is executed when the page has finished parsing. The element must be added to the end of the list of scripts that will execute when the document has finished parsing. Think about a [http://en.wikipedia.org/wiki/FIFO_%28computing%29 FIFO] processing queue : the first script element to be added to the queue will be the first script to be executed, then processing proceeds sequentially in the same order.
If the <tt>defer</tt> attribute is present, then the script is executed when the page has finished parsing. The element must be added to the end of the list of scripts that will execute when the document has finished parsing. Think about a [http://en.wikipedia.org/wiki/FIFO_%28computing%29 FIFO] processing queue : the first script element to be added to the queue will be the first script to be executed, then processing proceeds sequentially in the same order.


Navigation menu