Cleanup _.template docs and generate less unused code in compiled templates.

Former-commit-id: e6703414b83e9286d9ce5e14214375bbbaf9285f
This commit is contained in:
John-David Dalton
2012-08-19 02:13:43 -07:00
parent 985f4aafca
commit e4e41e5ef8
4 changed files with 66 additions and 56 deletions

View File

@@ -264,11 +264,8 @@
// http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']");
// remove brackets from `_.escape()` in `tokenizeEscape`
source = source.replace(/_\['escape']\("/, '_.escape("');
// remove brackets from `_.escape()` in `_.template`
source = source.replace(/__e *= *_\['escape']/, '__e=_.escape');
source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape');
// remove brackets from `collection.indexOf` in `_.contains`
source = source.replace("collection['indexOf'](target)", 'collection.indexOf(target)');