Skip to content
Permalink
Browse files

Script dataType now supports ecmascript mimetypes.

  • Loading branch information...
jaubourg committed Jan 31, 2011
1 parent f286a71 commit e0b1bb8e3d66db4166ac7ee2146903bae7ab1eb9
Showing with 21 additions and 11 deletions.
  1. +2 −2 src/ajax/script.js
  2. +5 −1 test/data/script.php
  3. +14 −8 test/unit/ajax.js
@@ -3,10 +3,10 @@
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript"
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript/
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
@@ -1,7 +1,11 @@
<?php
error_reporting(0);
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." );
@@ -1558,17 +1558,23 @@ test("jQuery.ajax() - malformed JSON", function() {
});

test("jQuery.ajax() - script by content-type", function() {
expect(1);
expect(2);

stop();

jQuery.ajax({
url: "data/script.php",
data: { header: "script" },
success: function() {
start();
}
});
jQuery.when(

jQuery.ajax({
url: "data/script.php",
data: { header: "script" }
}),

jQuery.ajax({
url: "data/script.php",
data: { header: "ecma" }
})

).then( start, start );
});

test("jQuery.ajax() - json by content-type", function() {

0 comments on commit e0b1bb8

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.