Modified test for load(); added fix for trigger, where it modifies data passed to it, which causes ugly side-effects
This commit is contained in:
parent
c0e0119c3d
commit
03b0a9c654
4 changed files with 9 additions and 4 deletions
|
@ -1,4 +1,6 @@
|
||||||
html text<br/>
|
html text<br/>
|
||||||
<script type="text/javascript">foo = "foo";</script>
|
<script type="text/javascript">/* <![CDATA[ */
|
||||||
|
foo = "foo"; $('#foo').html('foo');
|
||||||
|
/* ]]> */</script>
|
||||||
<script src="data/test.js"></script>
|
<script src="data/test.js"></script>
|
||||||
blabla
|
blabla
|
|
@ -1 +1,2 @@
|
||||||
foobar = "bar";
|
foobar = "bar";
|
||||||
|
$('#ap').html('bar');
|
||||||
|
|
|
@ -51,6 +51,8 @@ jQuery.fn.extend({
|
||||||
* window.foo = undefined;
|
* window.foo = undefined;
|
||||||
* var verifyEvaluation = function() {
|
* var verifyEvaluation = function() {
|
||||||
* ok( foobar == "bar", 'Check if script src was evaluated after load' );
|
* ok( foobar == "bar", 'Check if script src was evaluated after load' );
|
||||||
|
* ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM');
|
||||||
|
* ok( $('#ap').html() == 'bar', 'Check if script evaluation has modified DOM');
|
||||||
* start();
|
* start();
|
||||||
* };
|
* };
|
||||||
* $('#first').load('data/test.html', function() {
|
* $('#first').load('data/test.html', function() {
|
||||||
|
@ -62,7 +64,7 @@ jQuery.fn.extend({
|
||||||
* @name load
|
* @name load
|
||||||
* @type jQuery
|
* @type jQuery
|
||||||
* @param String url The URL of the HTML file to load.
|
* @param String url The URL of the HTML file to load.
|
||||||
* @param Hash params A set of key/value pairs that will be sent to the server.
|
* @param Object params A set of key/value pairs that will be sent to the server.
|
||||||
* @param Function callback A function to be executed whenever the data is loaded.
|
* @param Function callback A function to be executed whenever the data is loaded.
|
||||||
* @cat AJAX
|
* @cat AJAX
|
||||||
*/
|
*/
|
||||||
|
|
4
src/jquery/jquery.js
vendored
4
src/jquery/jquery.js
vendored
|
@ -2245,8 +2245,8 @@ jQuery.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
trigger: function(type,data,element) {
|
trigger: function(type,data,element) {
|
||||||
// Touch up the incoming data
|
// Clone the incoming data, if any
|
||||||
data = data || [];
|
data = $.merge([], data || []);
|
||||||
|
|
||||||
// Handle a global trigger
|
// Handle a global trigger
|
||||||
if ( !element ) {
|
if ( !element ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue