Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Enable bindingDelegate getter without bind attr
Browse files Browse the repository at this point in the history
Accessing the bindingDelegate of a <template> without a bind attribute
causes horrible errors: TypeError: Cannot read property 'raw' of
undefined
  • Loading branch information
timoxley committed Jan 23, 2014
1 parent 270abde commit 4ead88f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TemplateBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
},

get bindingDelegate() {
return this.delegate_.raw;
return this.delegate_ && this.delegate_.raw;
},

setDelegate_: function(delegate) {
Expand Down
7 changes: 7 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ suite('Template Instantiation', function() {
target.dispatchEvent(event);
}

test('accessing bindingDelegate getter without Bind', function(done) {
var div = createTestHtml('<template></template>');
var template = div.firstChild;
assert.strictEqual(template.bindingDelegate, undefined);
done();
});

test('Bind', function(done) {
var div = createTestHtml(
'<template bind={{}}>text</template>');
Expand Down

0 comments on commit 4ead88f

Please sign in to comment.