From a79f2af651972b47a3a84cc66604e1ed3cbd440e Mon Sep 17 00:00:00 2001 From: rwldrn Date: Tue, 5 Apr 2011 09:39:45 -0400 Subject: [PATCH] [#t465] DRY out repeated options.dataType.toLowerCase() --- popcorn.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/popcorn.js b/popcorn.js index db7adef..43889ee 100644 --- a/popcorn.js +++ b/popcorn.js @@ -332,7 +332,7 @@ return size; }, isArray: Array.isArray || function( array ) { - return toString.call( array ) === "[object Array]"; + return toString.call( array ) === "[object Array]"; }, nop: function () {} }); @@ -958,14 +958,16 @@ Popcorn.xhr = function ( options ) { + options.dataType = options.dataType && options.dataType.toLowerCase() || null; + if ( options.dataType && - ( options.dataType.toLowerCase() === "jsonp" || - options.dataType.toLowerCase() === "script" ) ) { + ( options.dataType === "jsonp" || + options.dataType === "script" ) ) { Popcorn.xhr.getJSONP( options.url, options.success, - options.dataType.toLowerCase() === "script" + options.dataType === "script" ); return; } @@ -975,10 +977,6 @@ // Create new XMLHttpRequest object settings.ajax = settings.xhr(); - // Normalize dataType - settings.dataType = settings.dataType.toLowerCase(); - - if ( settings.ajax ) { if ( settings.type === "GET" && settings.data ) { -- 2.43.0