From 03b0a9c654727e4bb551865793548c907687a4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Thu, 9 Nov 2006 21:16:03 +0000 Subject: [PATCH] Modified test for load(); added fix for trigger, where it modifies data passed to it, which causes ugly side-effects --- build/test/data/test.html | 4 +++- build/test/data/test.js | 1 + src/ajax/ajax.js | 4 +++- src/jquery/jquery.js | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build/test/data/test.html b/build/test/data/test.html index cdae2467..9d5b670b 100644 --- a/build/test/data/test.html +++ b/build/test/data/test.html @@ -1,4 +1,6 @@ html text
- + blabla \ No newline at end of file diff --git a/build/test/data/test.js b/build/test/data/test.js index 2764fe10..9294f06b 100644 --- a/build/test/data/test.js +++ b/build/test/data/test.js @@ -1 +1,2 @@ foobar = "bar"; +$('#ap').html('bar'); diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index 2ed53960..ecc0c643 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -51,6 +51,8 @@ jQuery.fn.extend({ * window.foo = undefined; * var verifyEvaluation = function() { * 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(); * }; * $('#first').load('data/test.html', function() { @@ -62,7 +64,7 @@ jQuery.fn.extend({ * @name load * @type jQuery * @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. * @cat AJAX */ diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 430e24f8..72596ad7 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -2245,8 +2245,8 @@ jQuery.extend({ }, trigger: function(type,data,element) { - // Touch up the incoming data - data = data || []; + // Clone the incoming data, if any + data = $.merge([], data || []); // Handle a global trigger if ( !element ) {