Permalink
Browse files

Handle undefined element in bindAttr and classNameBindings

  • Loading branch information...
wagenet committed Aug 7, 2012
1 parent d8f76a7 commit f1ec52aaa0713c7edeca237d38f172e0671a4c0e
Showing with 2 additions and 2 deletions.
  1. +2 −2 packages/ember-handlebars/lib/helpers/binding.js
@@ -293,7 +293,7 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
// to which we were bound has been removed from the view.
// In that case, we can assume the template has been re-rendered
// and we need to clean up the observer.
if (elem.length === 0) {
if (!elem || elem.length === 0) {

This comment has been minimized.

Show comment
Hide comment
@tomchiverton
@tomchiverton
Ember.removeObserver(pathRoot, path, invoker);
return;
}
@@ -408,7 +408,7 @@ EmberHandlebars.bindClasses = function(context, classBindings, view, bindAttrId,
// If we can't find the element anymore, a parent template has been
// re-rendered and we've been nuked. Remove the observer.
if (elem.length === 0) {
if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker);
} else {
// If we had previously added a class to the element, remove it.

0 comments on commit f1ec52a

Please sign in to comment.