Re: Dynamic loading of javascript files into web pages
- From: David Mark <dmark.cinsoft@xxxxxxxxx>
- Date: Sun, 28 Jun 2009 01:10:26 -0700 (PDT)
On Jun 28, 3:37 am, Jorge <jo...@xxxxxxxxxxxxxxxxx> wrote:
On Jun 28, 7:20 am, Garrett Smith <dhtmlkitc...@xxxxxxxxx> wrote:
Jorge wrote:
On Jun 27, 7:23 pm, Garrett Smith <dhtmlkitc...@xxxxxxxxx> wrote:
(...)
Steve says the technique is "safer". It is less safe because of the use
of eval. That point should have been clear.(...)
BTW, could you explain to me why/how is it any unsafer eval
(script.text) than a <script> tag ?
The eval function uses the calling context's [[Scope]], Variable object,
and |this| value.
When eval is called, and the code inside eval is parsed, assignment to
identifiers inside that eval'd code resolve to the calling context's
variable object when it is invoked.
Using a SCRIPT tag, that behavior does not happen.
Thanks, but AFAICS, an eval('code') at the top level is ===
<script>'code'</script> :
- 'this' === window,
Bad assumption, but irrelevant here.
- [[scope]] === global context, and
Not exactly.
And are you planning to run this XHR/eval combo in the global
context? I would expect it to reside in a function.
- no Variable 'object'.
See above.
.
- Follow-Ups:
- References:
- Dynamic loading of javascript files into web pages
- From: neilc
- Re: Dynamic loading of javascript files into web pages
- From: Peter Michaux
- Re: Dynamic loading of javascript files into web pages
- From: neilc
- Re: Dynamic loading of javascript files into web pages
- From: Jorge
- Re: Dynamic loading of javascript files into web pages
- From: Garrett Smith
- Re: Dynamic loading of javascript files into web pages
- From: Jorge
- Re: Dynamic loading of javascript files into web pages
- From: Jorge
- Re: Dynamic loading of javascript files into web pages
- From: Garrett Smith
- Re: Dynamic loading of javascript files into web pages
- From: Jorge
- Re: Dynamic loading of javascript files into web pages
- From: Garrett Smith
- Re: Dynamic loading of javascript files into web pages
- From: Jorge
- Dynamic loading of javascript files into web pages
- Prev by Date: Re: Dynamic loading of javascript files into web pages
- Next by Date: Re: Dynamic loading of javascript files into web pages
- Previous by thread: Re: Dynamic loading of javascript files into web pages
- Next by thread: Re: Dynamic loading of javascript files into web pages
- Index(es):
Relevant Pages
|
Loading