Pull out tag end regex

For perf -- avoids allocating another object.
This commit is contained in:
Ben Alpert
2015-07-21 11:53:03 -07:00
parent 82a9a5595e
commit 6fe034e6f9

View File

@@ -13,6 +13,8 @@
var adler32 = require('adler32');
var TAG_END = /\/?>/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
@@ -25,7 +27,7 @@ var ReactMarkupChecksum = {
// Add checksum (handle both parent tags and self-closing tags)
return markup.replace(
/\/?>/,
TAG_END,
' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'
);
},