There are some problems in $(xxx).load() function
You can see the example below, do you know what will be alerted?
////////////////////////////////////////
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/
nightlies/jquery-nightly.js"></script>
<script type="text/javascript">
function callback(args)
{
alert(typeof args)
}
function f1()
{
$('#parent').load('jq.html', null, callback)
}
</script>
</head>
<body>
<a href="#" onclick="f1()">Go</a>
<div id="parent">
</div>
</body>
</html>
////////////////////////////////////////////////////////////////////////
In jquery's source:
line 2451: self.each( callback, [res.responseText,
status, res] );
I found the callback function should have a array argument which
includes three elements, but when the callback function is called, it
can only get the first element of the array.
After some test, I found where the problem is :
in line 740: if ( callback.apply( object[ i ], args ) === false )
the usage callback.apply has problem, if I change "callback.apply"
to "callback.call", it can work correctly, though I don't know what
the real reason is.
Is it a bug?
Anyone can explain?