Commit e0b1bb8e authored by jaubourg's avatar jaubourg

Script dataType now supports ecmascript mimetypes.

parent f286a716
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
// Install script dataType // Install script dataType
jQuery.ajaxSetup({ jQuery.ajaxSetup({
accepts: { accepts: {
script: "text/javascript, application/javascript" script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
}, },
contents: { contents: {
script: /javascript/ script: /javascript|ecmascript/
}, },
converters: { converters: {
"text script": function( text ) { "text script": function( text ) {
......
<?php <?php
error_reporting(0); error_reporting(0);
if ( $_REQUEST['header'] ) { if ( $_REQUEST['header'] ) {
header("Content-type: text/javascript"); if ( $_REQUEST['header'] == "ecma" ) {
header("Content-type: application/ecmascript");
} else {
header("Content-type: text/javascript");
}
} }
?> ?>
ok( true, "Script executed correctly." ); ok( true, "Script executed correctly." );
...@@ -1558,17 +1558,23 @@ test("jQuery.ajax() - malformed JSON", function() { ...@@ -1558,17 +1558,23 @@ test("jQuery.ajax() - malformed JSON", function() {
}); });
test("jQuery.ajax() - script by content-type", function() { test("jQuery.ajax() - script by content-type", function() {
expect(1); expect(2);
stop(); stop();
jQuery.ajax({ jQuery.when(
url: "data/script.php",
data: { header: "script" }, jQuery.ajax({
success: function() { url: "data/script.php",
start(); data: { header: "script" }
} }),
});
jQuery.ajax({
url: "data/script.php",
data: { header: "ecma" }
})
).then( start, start );
}); });
test("jQuery.ajax() - json by content-type", function() { test("jQuery.ajax() - json by content-type", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment