Skip to content

Commit

Permalink
Revert emberjs#3218 and add deprecation notice for global Handlebars …
Browse files Browse the repository at this point in the history
…lookups.

Conflicts:
	features.json
  • Loading branch information
Christian Wesselhoeft committed Feb 13, 2014
1 parent b339f27 commit d704c86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
7 changes: 0 additions & 7 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ for a detailed explanation.

Added in [#3655](https://github.com/emberjs/ember.js/pull/3655).

* `ember-handlebars-caps-lookup`
Forces Handlebars values starting with capital letters, like `{{CONSTANT}}`,
to always be looked up on `Ember.lookup`. Previously, these values would be
looked up on the controller in certain cases.

Added in [#3218](https://github.com/emberjs/ember.js/pull/3218)

* `ember-testing-simple-setup`
Removes the need for most of the ceremony of setting up an application for testing. The following
examples are equivalent:
Expand Down
1 change: 0 additions & 1 deletion features.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"query-params-new": null,
"string-parameterize": null,
"ember-routing-named-substates": null,
"ember-handlebars-caps-lookup": null,
"ember-handlebars-log-primitives": true,
"ember-testing-simple-setup": null,
"ember-testing-routing-helpers": true,
Expand Down
30 changes: 9 additions & 21 deletions packages/ember-handlebars/lib/ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,17 @@ var handlebarsGet = Ember.Handlebars.get = function(root, path, options) {
normalizedPath = normalizePath(root, path, data),
value;

if (Ember.FEATURES.isEnabled("ember-handlebars-caps-lookup")) {
// In cases where the path begins with a keyword, change the
// root to the value represented by that keyword, and ensure
// the path is relative to it.
root = normalizedPath.root;
path = normalizedPath.path;

// If the path starts with a capital letter, look it up on Ember.lookup,
// which defaults to the `window` object in browsers.
if (Ember.isGlobalPath(path)) {
value = Ember.get(Ember.lookup, path);
} else {

// In cases where the path begins with a keyword, change the
// root to the value represented by that keyword, and ensure
// the path is relative to it.
value = Ember.get(normalizedPath.root, normalizedPath.path);
}
value = Ember.get(root, path);

} else {
root = normalizedPath.root;
path = normalizedPath.path;

value = Ember.get(root, path);

if (value === undefined && root !== Ember.lookup && Ember.isGlobalPath(path)) {
value = Ember.get(Ember.lookup, path);
}
if (value === undefined && root !== Ember.lookup && Ember.isGlobalPath(path)) {
Ember.deprecate("Global lookup from a Handlebars template is deprecated.");
value = Ember.get(Ember.lookup, path);
}

return value;
Expand Down

0 comments on commit d704c86

Please sign in to comment.