Michael Geary wrote:
require( 'test.js', function() {
// This code runs when the script is loaded
});
jQuery already had the $.getScript function to use the same way as the
require in your example above. And this is the reason we are trying to have
it work properly in this
Karl Rudd wrote:
// window.setTimeout(s,0); // blah() fails in all
Karl Rudd
This is very surprising. I tested the setTimeout before posting Jeff's
installScript to this thread, and I found that it worked. But my test was
inappropriate, because I wanted it to succeed with my
Jörn Zaefferer wrote:
Looks good for me.
I have browsed dojo and prototype today, but they seem to do nothing special
for eval, ie: I think that they share the same problem, but are unaware of
it.
--
View this message in context:
If so, you can not override jQuery.getScript function.
But my test result is, IE6 and FF2 would wait to finish downloading the
script
and continue the program.
jQuery.getScript = function (src, callback) {
var js = document.createElement('SCRIPT');
js.type = 'text/javascript';
Why not use document.createElement(script) !?
Because we want jQuery to wait until the script is loaded and
evaluated, so it's possible to do something upon completion,
like continuing the normal flow of the program. This is
necessary for example for writing a require like the one in
Paul McLanahan schrieb:
Cool.. Didn't know that. I do know that the reason that the
window.setTimeout function is used is that Safari doesn't obey the
eval.call context, but it does eval scripts in setTimeout globally.
So we'll have to do a little more browser detection to get it done
Well... ok.. Mozilla based browsers. But that is far from being only
Firefox (Mozilla, Camino, Flock, Netscape, etc.). It is indeed
deprecated, but you know how that goes... how long has the font tag
been deprecated, but browsers will continue supporting it for the
foreseeable future. I'm sure
Paul McLanahan schrieb:
Well... ok.. Mozilla based browsers. But that is far from being only
Firefox (Mozilla, Camino, Flock, Netscape, etc.). It is indeed
deprecated, but you know how that goes... how long has the font tag
been deprecated, but browsers will continue supporting it for the
I completely agree, Klaus. I'm not suggesting we rely on that
feature. I'm suggesting that we use another name for a global eval
function in jQuery so that we don't interfere with the feature while
it's still around. I would definitely not use it in the global eval
function that we're tweaking
Jorn: I'm not sure which versions of Safari are affected. I'll do
some more research and get back to you. Hopefully it's fixed in
recent versions and we won't have to worry about it. I don't have SVN
access here at work, or I'd update my working copy and run the test
suite on safari 1.3.2
Ok... I was able to confirm that, at least for the version of Safari I
have (1.3.2 on OSX.3.9), the eval.call(window,data) attempt at global
scope eval does not work. I got some strange Object (result of
expression testFunction) does not allow calls error, where
testFunction was the function I
Paul McLanahan schrieb:
jQuery.gEval = function(data){
if(window.execScript) // msie
window.execScript(data);
else if(jQuery.browser.safari) // safari
window.setTimeout(data,0);
else // all others
eval.call( window, data );
}
I just checked eval.call(window,data) on Safari 2.0.4 and it did NOT
work. The function was available immediately, but only in the scope
of the httpData function. And with window.setTimeout it was available
globally, but not immediately inside of httpData
grumbles:incoherrently/
Example...
I don't have access to safari right now, but perhaps this might work:
self.eval(); // or window.self.eval if you can see the performance change
I remember having a similar problem with firefox a bit ago using window.eval()
and that fixed it. I ended up with:
(window.execScript ||
That's a cool fix. I really like your syntax. However, Safari still
won't eval that globally either using self.eval or window.eval. That
is as tested on Safari 1.3, I don't have easy access to 2.0. I can
try it there later though.
On 11/22/06, Francisco Brito [EMAIL PROTECTED] wrote:
I don't
I can confirm that (window.execScript || self.eval)(script) does NOT
work in Safari 2.0.4 (419.3). It also does not work in Opera 9.
The test harness I used was:
var local = test;
(function() {
var s = 'function blah(){alert(from blah());};
local=changed;';
Paul McLanahan schrieb:
In most modern browsers (IE Excluded of course), the built in eval
function is defined on all objects. This is designed to combat the
problem we're trying to fix now, which is that you can eval code in
specific context (in FF for examle) by just calling
I've created a trouble ticket for it here:
http://jquery.com/dev/bugs/bug/407/
--John
On 11/17/06, Andrea Ercolino [EMAIL PROTECTED] wrote:
Hi everybody.
While developing the PunchCard widget I've found a problem with getScript in
IE7.
If you are interested in helping me, I've isolated
Found and patched the problem in ajax.js where $.getScript and
$.getJSON don't do anything if a callback isn't supplied. The problem
is that httpData function isn't called from $.ajax unless there is a
callback supplied. Someone please commit if it's deemed a good fix.
The only other fix is to
As Norbert just pointed out in the thread Dynamically Loaded Scripts
in IE 7 - Problems Found and Lessons Learned, it is a scope issue.
If the functions in your script file loaded via getScript use either
of the following two methods (they're synonymous) then the functions
will not be available in
I don't understand how to apply the workaround.
It's fine to adjust the script which control the loading, and I think your
last workaround say how to do it, but I don't understand it. Could you
please reference my test code?
Paul McLanahan wrote:
As Norbert just pointed out in the thread
OK, thanks Paul.
--
View this message in context:
http://www.nabble.com/getScript-error-tf2652417.html#a7413328
Sent from the JQuery mailing list archive at Nabble.com.
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
Good point, Arash. I think this bug does need to be fixed. -AshutoshOn 9/9/06, Arash Yalpani [EMAIL PROTECTED]
wrote:Calling $.getScript with only one parameter, being the url, I always get
this message (on FF):data has no propertiesIt points to line 226 of
23 matches
Mail list logo