From 53aa2e0c8baf047ca0375c52dfbf00eaede994a6 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Thu, 12 Sep 2013 15:49:15 -0500 Subject: [PATCH] Use charAt instead of string indexing for oldIE's sake. Fixes #14356. --- src/ajax.js | 2 +- test/unit/ajax.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index cdd55a0a3..aa3bab348 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -78,7 +78,7 @@ function addToPrefiltersOrTransports( structure ) { // For each dataType in the dataTypeExpression while ( (dataType = dataTypes[i++]) ) { // Prepend if requested - if ( dataType[0] === "+" ) { + if ( dataType.charAt( 0 ) === "+" ) { dataType = dataType.slice( 1 ) || "*"; (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 152dabb4a..22fed363c 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -1568,9 +1568,10 @@ module( "ajax", { //----------- jQuery.ajaxPrefilter() ajaxTest( "jQuery.ajaxPrefilter() - abort", 1, { + dataType: "prefix", setup: function() { // Ensure prefix does not throw an error - jQuery.ajaxPrefilter("+prefix *", function( options, _, jqXHR ) { + jQuery.ajaxPrefilter("+prefix", function( options, _, jqXHR ) { if ( options.abortInPrefilter ) { jqXHR.abort(); } -- 2.39.5