]> source.dussan.org Git - jquery.git/commitdiff
Change embedded regexp to a variable (for #6876).
authorDave Methvin <dave.methvin@gmail.com>
Sun, 9 Jan 2011 22:22:11 +0000 (16:22 -0600)
committerColin Snover <github.com@zetafleet.com>
Sun, 9 Jan 2011 22:22:11 +0000 (16:22 -0600)
src/ajax.js

index dbea8d5d4883365540119f80aaad19ea7846cd2c..d570fcccb8173d02e34ddf59e118fff4ebdc3ec0 100644 (file)
@@ -11,6 +11,7 @@ var r20 = /%20/g,
        rselectTextarea = /^(?:select|textarea)/i,
        rts = /([?&])_=[^&]*/,
        rurl = /^(\w+:)?\/\/([^\/?#:]+)(?::(\d+))?/,
+       rCRLF = /\r?\n/g,
 
        // Slice function
        sliceFunc = Array.prototype.slice,
@@ -107,9 +108,9 @@ jQuery.fn.extend({
                                null :
                                jQuery.isArray(val) ?
                                        jQuery.map( val, function(val, i){
-                                               return {name: elem.name, value: val.replace(/\r?\n/g, "\r\n")};
+                                               return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
                                        }) :
-                                       {name: elem.name, value: val.replace(/\r?\n/g, "\r\n")};
+                                       { name: elem.name, value: val.replace(rCRLF, "\r\n") };
                }).get();
        }
 });