From 371f49289120cc4bc29494b8f00adcd71793bfb6 Mon Sep 17 00:00:00 2001 From: Pete Nykanen Date: Tue, 29 Dec 2015 13:37:47 +0200 Subject: [PATCH] Update Mustache to v2.2.1 --- src/brackets.js | 17 +++++++++++++++++ src/extensibility/ExtensionManagerView.js | 12 ++++-------- src/thirdparty/CodeMirror | 2 +- src/thirdparty/mustache | 2 +- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/brackets.js b/src/brackets.js index a362e8d2d43..b5455586662 100644 --- a/src/brackets.js +++ b/src/brackets.js @@ -114,6 +114,23 @@ define(function (require, exports, module) { return CodeMirror; } }); + + // DEPRECATED: Mustache.compile has been deprecated since Mustache 0.8, + // but for now we use a polyfill for it so as to avoid breaking extensions in the + // interim. + Object.defineProperty(window.Mustache, "compile", { + get: function () { + DeprecationWarning.deprecationWarning('Use Mustache.parse(templateName) instead of Mustache.compile. For more information see https://github.com/janl/mustache.js/issues/346.', true); + + return function (template) { + Mustache.parse(template); + + return function (view, partials) { + return Mustache.render(template, view, partials); + }; + }; + } + }); // Load modules that self-register and just need to get included in the main project require("command/DefaultMenus"); diff --git a/src/extensibility/ExtensionManagerView.js b/src/extensibility/ExtensionManagerView.js index 91b470f72fb..b6ea5ae1682 100644 --- a/src/extensibility/ExtensionManagerView.js +++ b/src/extensibility/ExtensionManagerView.js @@ -37,6 +37,9 @@ define(function (require, exports, module) { LocalizationUtils = require("utils/LocalizationUtils"), itemTemplate = require("text!htmlContent/extension-manager-view-item.html"); + // Parse item template for future use + Mustache.parse(itemTemplate); + /** * Creates a view enabling the user to install and manage extensions. Must be initialized * with initialize(). When the view is closed, dispose() must be called. @@ -56,7 +59,6 @@ define(function (require, exports, module) { var self = this, result = new $.Deferred(); this.model = model; - this._itemTemplate = Mustache.compile(itemTemplate); this._itemViews = {}; this.$el = $("
"); this._$emptyMessage = $("
") @@ -100,12 +102,6 @@ define(function (require, exports, module) { */ ExtensionManagerView.prototype._$table = null; - /** - * @private - * @type {function} The compiled template we use for rendering items in the extension list. - */ - ExtensionManagerView.prototype._itemTemplate = null; - /** * @private * @type {Object.} @@ -336,7 +332,7 @@ define(function (require, exports, module) { context[helper] = registry_utils[helper]; }); - return $(this._itemTemplate(context)); + return $(Mustache.render(itemTemplate, context)); }; /** diff --git a/src/thirdparty/CodeMirror b/src/thirdparty/CodeMirror index 61ca2db598f..291b06eb891 160000 --- a/src/thirdparty/CodeMirror +++ b/src/thirdparty/CodeMirror @@ -1 +1 @@ -Subproject commit 61ca2db598f3f1d79e837f326bc740e8bc49e62a +Subproject commit 291b06eb891ff63bc010795bd492e9a672c13566 diff --git a/src/thirdparty/mustache b/src/thirdparty/mustache index 0be4e2b9446..cd06b22dabd 160000 --- a/src/thirdparty/mustache +++ b/src/thirdparty/mustache @@ -1 +1 @@ -Subproject commit 0be4e2b9446ccac052a8e74e57fe6d7444dcc231 +Subproject commit cd06b22dabdaeffe3e4c74ee02bd492a11bbb740