script elements

Alex Russell alex at netWindows.org
Wed Feb 19 23:07:57 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 20 February 2003 03:53 pm, Dirk Mueller wrote:
> On Mit, 19 Feb 2003, Alex Russell wrote:
> > (context for the kfm-devel list: a web developer wants to dynamically
> > create a <script> element via DOM operations and have the script
> > specified in the src attribute sourced when the attribute is assigned)
>
> Ah, I see. Does that have to work everywhere, i.e. like in an onclick
> handler?

For script elements, being able to re-set the src property might not be a 
necessity (mozilla 1.2 does not seem to support this), but certinaly 
specifying the src for a new element would be. Whether or not the script is 
sourced before or after the <script> element is added to the active DOM 
tree is something I'm not sure about.

The behaviour in both Mozilla and IE seems to be to deferr sourcing of the 
URL until such time as the <script> node is made a child of <head>.

> I guess the execution of the script has to stop until the foo.js has been
> fetched from the net and been executed?

IE and recent builds of Moz do not seem to pause execution of other scripts 
while a script is sourced, although whether they block execution of other 
scripts while they evaluate after download is something I do not know.

Test pages are at:

	http://66.222.35.235/~alex/script_inclusion_test/blocking_test.html
	http://66.222.35.235/~alex/script_inclusion_test/timing_test.html

> does the foo.js script have any knowledge from where it is called? does
> i.e. "this" have a special meaning for foo.js ?

There seems to be no special knowledge of where a script is sourced from (or 
the context from which it is sourced) imparted. I don't beleive that the 
script will have any context other than "window" (unlike an eval() in the 
same context under JS < 1.5).

HTH

- -- 
Alex Russell
alex at netWindows.org
alex at SecurePipe.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+VA5NoV0dQ6uSmkYRAvRBAJ4niQ9m7UbHxay/fpuSGCeN1T0K9QCfeE1b
z6JYlBkfD4uv+E/KaZheEs4=
=/e73
-----END PGP SIGNATURE-----


Unsubscribe
wdf-dom-unsubscribe at egroups.com

List info
http://www.xs4all.nl/~ppk/js/list.html
 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 






More information about the kfm-devel mailing list