diff --git a/src/TemplateBinding.js b/src/TemplateBinding.js index 5dbca17..b6dc8f6 100644 --- a/src/TemplateBinding.js +++ b/src/TemplateBinding.js @@ -23,8 +23,9 @@ var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach); function getFragmentRoot(node) { - while (node.parentNode) { - node = node.parentNode; + var p; + while (p = node.parentNode) { + node = p; } return node; diff --git a/tests/tests.js b/tests/tests.js index 92e5a03..6671f42 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -1410,6 +1410,13 @@ suite('Template Instantiation', function() { }); test('Ref at multiple', function() { + // Note: this test is asserting that template "ref"erences can be located + // at various points. In particular: + // -in the document (at large) (e.g. ref=doc) + // -within template content referenced from sub-content + // -both before and after the reference + // The following asserts ensure that all referenced templates content is + // found. var id = 't' + Math.random(); var div = createTestHtml( '