diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index c3b1384b0..de6fba4a7 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -63,6 +63,11 @@ HandlebarsEnvironment.prototype = { }, registerDecorator: function(name, fn) { + this.log('warn', 'Custom decorators are deprecated and will be removed in the future. Join the discussion at https://github.com/wycats/handlebars.js/issues/1574'); + this.registerDecoratorWithoutDeprecationWarning(name, fn); + }, + + registerDecoratorWithoutDeprecationWarning: function(name, fn) { if (toString.call(name) === objectType) { if (fn) { throw new Exception('Arg not supported with multiple decorators'); } extend(this.decorators, name); @@ -70,6 +75,7 @@ HandlebarsEnvironment.prototype = { this.decorators[name] = fn; } }, + unregisterDecorator: function(name) { delete this.decorators[name]; } diff --git a/lib/handlebars/decorators/inline.js b/lib/handlebars/decorators/inline.js index 214246620..a79e3a68a 100644 --- a/lib/handlebars/decorators/inline.js +++ b/lib/handlebars/decorators/inline.js @@ -1,7 +1,7 @@ import {extend} from '../utils'; export default function(instance) { - instance.registerDecorator('inline', function(fn, props, container, options) { + instance.registerDecoratorWithoutDeprecationWarning('inline', function(fn, props, container, options) { let ret = fn; if (!props.partials) { props.partials = {}; diff --git a/spec/blocks.js b/spec/blocks.js index 2fbaee7cc..714042a34 100644 --- a/spec/blocks.js +++ b/spec/blocks.js @@ -306,7 +306,7 @@ describe('blocks', function() { equals(run, true); }); - describe('registration', function() { + describe.only('registration', function() { it('unregisters', function() { handlebarsEnv.decorators = {};