I did some tests[1] and noticed that $().load now suffers from the same
"double script eval" that the OP was complaining about. It seems that
Firefox eval's scripts as soon as they are appended to the DOM tree (and
it's the only browser, as far as I can tell, that does this) so doing
something like
$("#target").html('<script
type="text/javascript">alert("foo");</script>').evalScripts()
would cause "foo" to get alerted twice in Firefox, but only once in every
other browser (and in those browsers, it would be the evalScripts() call
that would cause it). My solution to this was to simply prevent
evalScripts() from running in Firefox[2], as the way it is most often used
ends up making it redundant. It should be noted that I have *never*
experienced this "double script eval" in any other Windows browser (I don't
own a Mac, so I can't test there).
[1] http://aheimlich.freepgs.com/tests/jquery/ajax-load/index.html
[2] http://aheimlich.freepgs.com/tests/jquery/ajax-load/patched.html
On 2/16/07, Mike Alsup <[EMAIL PROTECTED]> wrote:
> Interesting, your fix (replacing jQuery(options.target).html(data) with
> jQuery(options.target).attr("innerHTML", data) )[1] was reported as bug
> #914[2] about 2 weeks ago (the issue being that $().attr("innerHTML",
data)
> was failing in IE6) and the solution Brandon came up[3] with was to
replace
> that with $().html(data). I wonder if $().load is having this issue as
well
> (though I don't recall anyone complaining about $().load executing
scripts
> twice)?
I haven't heard of any issues with $().load. I just copied the code
from there. It passes the unit tests in IE6.
Mike
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/