aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-08-25 03:55:12 +0000
committerJohn Resig <jeresig@gmail.com>2007-08-25 03:55:12 +0000
commit0477a6e99e95ae93da983e7fc2a30bf16ea8ca77 (patch)
treec821cac7f861308c64035559d38c4e6d485e4afd /src/ajax
parent34f1042902f8dbf133fdc3c62d17e12ec0cb7a26 (diff)
downloadjquery-0477a6e99e95ae93da983e7fc2a30bf16ea8ca77.tar.gz
jquery-0477a6e99e95ae93da983e7fc2a30bf16ea8ca77.zip
Added a test case for "purple include", fixed a bug.
Diffstat (limited to 'src/ajax')
-rw-r--r--src/ajax/ajax.js6
-rw-r--r--src/ajax/ajaxTest.js9
2 files changed, 13 insertions, 2 deletions
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index 795cd8a9e..ccf4f14a9 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -49,8 +49,10 @@ jQuery.fn.extend({
return this.bind("load", url);
var off = url.indexOf(" ");
- var selector = url.slice(off, url.length);
- url = url.slice(0, off);
+ if ( off >= 0 ) {
+ var selector = url.slice(off, url.length);
+ url = url.slice(0, off);
+ }
callback = callback || function(){};
diff --git a/src/ajax/ajaxTest.js b/src/ajax/ajaxTest.js
index 4d4bc0791..0fd4888ac 100644
--- a/src/ajax/ajaxTest.js
+++ b/src/ajax/ajaxTest.js
@@ -94,6 +94,15 @@ test("load(String)", function() {
$('#first').load("data/name.html", start);
});
+test("load('url selector')", function() {
+ expect(1);
+ stop(true); // check if load can be called with only url
+ $('#first').load("data/test3.html div.user", function(){
+ equals( $(this).children("div").length, 2, "Verify that specific elements were injected" );
+ start();
+ });
+});
+
test("load(String, Function) - simple: inject text into DOM", function() {
expect(2);
stop();