[whatwg] When do scripts execute? (4.3.1)

Boris Zbarsky bzbarsky at MIT.EDU
Thu Jan 15 08:28:10 PST 2009


Kartikaya Gupta wrote:
>  sn = document.createElement( 'script' );
>  sn.setAttribute( 'type', 'text/javascript' );
>  document.body.appendChild( sn );        // this *should* run an empty script block and do nothing

That looks like a bug in the spec to me.  Empty scripts with no @src are 
not executed when inserted into the DOM, and are executed if they ever 
become nonempty or have their src set.

-Boris




More information about the whatwg mailing list