06 JavaScriptClientSide
06 JavaScriptClientSide
<script> tag and its usages, execution order and defer type=text/javascript Content-Script-Type header or meta XHTML and <![CDATA[]]>
Inline JavaScript in event handlers (onclick, onmouseover) head, body, onload, onbeforeunload and onunload
Level 0 DOM
JavaScript is single-threaded
Execution should not take too long and degrade user interaction setTimeout( ,0) and deferring execution
Manipulating documents while loading is not safe Document-ready: DOMContentLoaded / deferred script
if (element.addEventListener) { }
else if (element.attachEvent) { } else { element.eventName = handler; }
http://www.quirksmode.org/compatibility.html
JavaScript Security
Simulate a CPU-intensive task triggered by user and without disrupting user control