]> source.dussan.org Git - jquery.git/commitdiff
Script dataType now supports ecmascript mimetypes.
authorjaubourg <j@ubourg.net>
Mon, 31 Jan 2011 18:14:06 +0000 (19:14 +0100)
committerjaubourg <j@ubourg.net>
Mon, 31 Jan 2011 18:14:06 +0000 (19:14 +0100)
src/ajax/script.js
test/data/script.php
test/unit/ajax.js

index 91c84d6f41d540ab96e171012ffa0aa59d258126..731f5b609f3f4fa78dc912536d57d7cb70ac8128 100644 (file)
@@ -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 ) {
index 55d7bc209f55b6d48af9452e02198f2cf5f5f066..fb7110491fe24853d9c2fdf47e1c89fb07ca3747 100644 (file)
@@ -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." );
index 31b319c370aabbe23d976c5741105cbfdf7a8c6c..33f278274887b6f454e30be0eed350f0697ab441 100644 (file)
@@ -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() {