mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Some work to modularize ajax later on.
This commit is contained in:
parent
5f35b3d9f9
commit
ac48a19b92
@ -340,14 +340,14 @@ jQuery.fn.extend({
|
|||||||
if ( scripts.length ) {
|
if ( scripts.length ) {
|
||||||
jQuery.each( scripts, function( i, elem ) {
|
jQuery.each( scripts, function( i, elem ) {
|
||||||
if ( elem.src ) {
|
if ( elem.src ) {
|
||||||
jQuery.ajax({
|
jQuery.ajax ? jQuery.ajax({
|
||||||
url: elem.src,
|
url: elem.src,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: "script",
|
dataType: "script",
|
||||||
async: false,
|
async: false,
|
||||||
global: false,
|
global: false,
|
||||||
throws: true
|
throws: true
|
||||||
});
|
}) : jQuery.error( "no ajax" );
|
||||||
} else {
|
} else {
|
||||||
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
|
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ function url( value ) {
|
|||||||
var oldCacheLength = 0,
|
var oldCacheLength = 0,
|
||||||
oldFragmentsLength = 0,
|
oldFragmentsLength = 0,
|
||||||
oldTimersLength = 0,
|
oldTimersLength = 0,
|
||||||
oldActive = 0;
|
oldActive = jQuery.active;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that tests have cleaned up properly after themselves. Should be passed as the
|
* Ensures that tests have cleaned up properly after themselves. Should be passed as the
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module("ajax", { teardown: moduleTeardown });
|
module("ajax", { teardown: moduleTeardown });
|
||||||
|
|
||||||
if ( !isLocal || hasPHP) {
|
if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
|
||||||
|
|
||||||
test("jQuery.ajax() - success callbacks", function() {
|
test("jQuery.ajax() - success callbacks", function() {
|
||||||
expect( 8 );
|
expect( 8 );
|
||||||
|
@ -683,7 +683,7 @@ test("removeProp(String)", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("val()", function() {
|
test("val()", function() {
|
||||||
expect(26);
|
expect( 20 + ( jQuery.fn.serialize ? 6 : 0 ) );
|
||||||
|
|
||||||
document.getElementById("text1").value = "bla";
|
document.getElementById("text1").value = "bla";
|
||||||
equal( jQuery("#text1").val(), "bla", "Check for modified value of input element" );
|
equal( jQuery("#text1").val(), "bla", "Check for modified value of input element" );
|
||||||
@ -726,6 +726,7 @@ test("val()", function() {
|
|||||||
jQuery("#select5").val(3);
|
jQuery("#select5").val(3);
|
||||||
equal( jQuery("#select5").val(), "3", "Check value on ambiguous select." );
|
equal( jQuery("#select5").val(), "3", "Check value on ambiguous select." );
|
||||||
|
|
||||||
|
if ( jQuery.fn.serialize ) {
|
||||||
var checks = jQuery("<input type='checkbox' name='test' value='1'/><input type='checkbox' name='test' value='2'/><input type='checkbox' name='test' value=''/><input type='checkbox' name='test'/>").appendTo("#form");
|
var checks = jQuery("<input type='checkbox' name='test' value='1'/><input type='checkbox' name='test' value='2'/><input type='checkbox' name='test' value=''/><input type='checkbox' name='test'/>").appendTo("#form");
|
||||||
|
|
||||||
deepEqual( checks.serialize(), "", "Get unchecked values." );
|
deepEqual( checks.serialize(), "", "Get unchecked values." );
|
||||||
@ -745,6 +746,7 @@ test("val()", function() {
|
|||||||
deepEqual( checks.serialize(), "test=1&test=on", "Get multiple checked values." );
|
deepEqual( checks.serialize(), "test=1&test=on", "Get multiple checked values." );
|
||||||
|
|
||||||
checks.remove();
|
checks.remove();
|
||||||
|
}
|
||||||
|
|
||||||
var $button = jQuery("<button value='foobar'>text</button>").insertAfter("#button");
|
var $button = jQuery("<button value='foobar'>text</button>").insertAfter("#button");
|
||||||
equal( $button.val(), "foobar", "Value retrieval on a button does not return innerHTML" );
|
equal( $button.val(), "foobar", "Value retrieval on a button does not return innerHTML" );
|
||||||
|
@ -236,7 +236,7 @@ test( "globalEval", function() {
|
|||||||
window.globalEvalTest = undefined;
|
window.globalEvalTest = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( !isLocal ) {
|
if ( jQuery.get && !isLocal ) {
|
||||||
test("browser", function() {
|
test("browser", function() {
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ test("append(xml)", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("appendTo(String|Element|Array<Element>|jQuery)", function() {
|
test("appendTo(String|Element|Array<Element>|jQuery)", function() {
|
||||||
expect(17);
|
expect( 16 + ( jQuery.getScript ? 1 : 0 ) );
|
||||||
|
|
||||||
var defaultText = "Try them out:"
|
var defaultText = "Try them out:"
|
||||||
jQuery("<b>buga</b>").appendTo("#first");
|
jQuery("<b>buga</b>").appendTo("#first");
|
||||||
@ -699,11 +699,13 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() {
|
|||||||
|
|
||||||
QUnit.reset();
|
QUnit.reset();
|
||||||
|
|
||||||
|
if ( jQuery.getScript ) {
|
||||||
stop();
|
stop();
|
||||||
jQuery.getScript('data/test.js', function() {
|
jQuery.getScript('data/test.js', function() {
|
||||||
jQuery('script[src*="data\\/test\\.js"]').remove();
|
jQuery('script[src*="data\\/test\\.js"]').remove();
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var testPrepend = function(val) {
|
var testPrepend = function(val) {
|
||||||
|
@ -38,13 +38,14 @@ testIframeWithCallback( "A background on the testElement does not cause IE8 to c
|
|||||||
ok( true, "IE8 does not crash" );
|
ok( true, "IE8 does not crash" );
|
||||||
});
|
});
|
||||||
|
|
||||||
var userAgent = window.navigator.userAgent;
|
(function() {
|
||||||
|
|
||||||
|
var userAgent = window.navigator.userAgent,
|
||||||
|
expected;
|
||||||
|
|
||||||
// These tests do not have to stay
|
// These tests do not have to stay
|
||||||
// They are here to help with upcoming support changes for 1.8
|
// They are here to help with upcoming support changes for 1.8
|
||||||
if ( /chrome\/19\.0/i.test(userAgent) ) {
|
if ( /chrome\/19\.0/i.test(userAgent) ) {
|
||||||
test("Verify that the support tests resolve as expected per browser", function() {
|
|
||||||
var i,
|
|
||||||
expected = {
|
expected = {
|
||||||
"leadingWhitespace":true,
|
"leadingWhitespace":true,
|
||||||
"tbody":true,
|
"tbody":true,
|
||||||
@ -77,13 +78,7 @@ if ( /chrome\/19\.0/i.test(userAgent) ) {
|
|||||||
"cors":true,
|
"cors":true,
|
||||||
"doesNotIncludeMarginInBodyOffset":true
|
"doesNotIncludeMarginInBodyOffset":true
|
||||||
};
|
};
|
||||||
for ( i in expected ) {
|
|
||||||
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if ( /msie 8\.0/i.test(userAgent) ) {
|
} else if ( /msie 8\.0/i.test(userAgent) ) {
|
||||||
test("Verify that the support tests resolve as expected per browser", function() {
|
|
||||||
var i,
|
|
||||||
expected = {
|
expected = {
|
||||||
"leadingWhitespace":false,
|
"leadingWhitespace":false,
|
||||||
"tbody":true,
|
"tbody":true,
|
||||||
@ -116,13 +111,7 @@ if ( /chrome\/19\.0/i.test(userAgent) ) {
|
|||||||
"cors":false,
|
"cors":false,
|
||||||
"doesNotIncludeMarginInBodyOffset":true
|
"doesNotIncludeMarginInBodyOffset":true
|
||||||
};
|
};
|
||||||
for ( i in expected ) {
|
|
||||||
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if ( /msie 7\.0/i.test(userAgent) ) {
|
} else if ( /msie 7\.0/i.test(userAgent) ) {
|
||||||
test("Verify that the support tests resolve as expected per browser", function() {
|
|
||||||
var i,
|
|
||||||
expected = {
|
expected = {
|
||||||
"ajax": true,
|
"ajax": true,
|
||||||
"appendChecked": false,
|
"appendChecked": false,
|
||||||
@ -155,13 +144,7 @@ if ( /chrome\/19\.0/i.test(userAgent) ) {
|
|||||||
"tbody": false,
|
"tbody": false,
|
||||||
"style": false
|
"style": false
|
||||||
};
|
};
|
||||||
for ( i in expected ) {
|
|
||||||
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if ( /msie 6\.0/i.test(userAgent) ) {
|
} else if ( /msie 6\.0/i.test(userAgent) ) {
|
||||||
test("Verify that the support tests resolve as expected per browser", function() {
|
|
||||||
var i,
|
|
||||||
expected = {
|
expected = {
|
||||||
"leadingWhitespace":false,
|
"leadingWhitespace":false,
|
||||||
"tbody":false,
|
"tbody":false,
|
||||||
@ -194,13 +177,7 @@ if ( /chrome\/19\.0/i.test(userAgent) ) {
|
|||||||
"cors":false,
|
"cors":false,
|
||||||
"doesNotIncludeMarginInBodyOffset":true
|
"doesNotIncludeMarginInBodyOffset":true
|
||||||
};
|
};
|
||||||
for ( i in expected ) {
|
|
||||||
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if ( /5\.1\.1 safari/i.test(userAgent) ) {
|
} else if ( /5\.1\.1 safari/i.test(userAgent) ) {
|
||||||
test("Verify that the support tests resolve as expected per browser", function() {
|
|
||||||
var i,
|
|
||||||
expected = {
|
expected = {
|
||||||
"leadingWhitespace":true,
|
"leadingWhitespace":true,
|
||||||
"tbody":true,
|
"tbody":true,
|
||||||
@ -233,13 +210,7 @@ if ( /chrome\/19\.0/i.test(userAgent) ) {
|
|||||||
"cors":true,
|
"cors":true,
|
||||||
"doesNotIncludeMarginInBodyOffset":true
|
"doesNotIncludeMarginInBodyOffset":true
|
||||||
};
|
};
|
||||||
for ( i in expected ) {
|
|
||||||
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if ( /firefox\/3\.6/i.test(userAgent) ) {
|
} else if ( /firefox\/3\.6/i.test(userAgent) ) {
|
||||||
test("Verify that the support tests resolve as expected per browser", function() {
|
|
||||||
var i,
|
|
||||||
expected = {
|
expected = {
|
||||||
"leadingWhitespace":true,
|
"leadingWhitespace":true,
|
||||||
"tbody":true,
|
"tbody":true,
|
||||||
@ -272,8 +243,16 @@ if ( /chrome\/19\.0/i.test(userAgent) ) {
|
|||||||
"cors":true,
|
"cors":true,
|
||||||
"doesNotIncludeMarginInBodyOffset":true
|
"doesNotIncludeMarginInBodyOffset":true
|
||||||
};
|
};
|
||||||
for ( i in expected ) {
|
}
|
||||||
|
|
||||||
|
test("Verify that the support tests resolve as expected per browser", function() {
|
||||||
|
for ( var i in expected ) {
|
||||||
|
if ( jQuery.isAjax || i !== "ajax" && i !== "cors" ) {
|
||||||
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
|
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user