aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-01-31 19:14:06 +0100
committerjaubourg <j@ubourg.net>2011-01-31 19:14:06 +0100
commite0b1bb8e3d66db4166ac7ee2146903bae7ab1eb9 (patch)
tree648ac28dd11a02536db15f56fce0be20bfbb02b6
parentf286a716d5e5836b8508eb5771624de0aafdb235 (diff)
downloadjquery-e0b1bb8e3d66db4166ac7ee2146903bae7ab1eb9.tar.gz
jquery-e0b1bb8e3d66db4166ac7ee2146903bae7ab1eb9.zip
Script dataType now supports ecmascript mimetypes.
-rw-r--r--src/ajax/script.js4
-rw-r--r--test/data/script.php6
-rw-r--r--test/unit/ajax.js22
3 files changed, 21 insertions, 11 deletions
diff --git a/src/ajax/script.js b/src/ajax/script.js
index 91c84d6f4..731f5b609 100644
--- a/src/ajax/script.js
+++ b/src/ajax/script.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 ) {
diff --git a/test/data/script.php b/test/data/script.php
index 55d7bc209..fb7110491 100644
--- a/test/data/script.php
+++ b/test/data/script.php
@@ -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." );
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 31b319c37..33f278274 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -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() {