Change embedded regexp to a variable (for #6876).

This commit is contained in:
Dave Methvin 2011-01-09 16:22:11 -06:00 committed by Colin Snover
parent 1d1d4fe112
commit 4e86766d54

View 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();
}
});