Closed jyasskin closed 10 years ago
related to this change: https://github.com/Polymer/TemplateBinding/commit/2c379a393ee73a80eda4ad3b38f6ec6a064c89c9
template.ref assumes getInstanceRoot returns a non-null value, which is only true if node was expanded from a template. My guess is that this line needs to have the if-check:
if (instanceRoot) ref = instanceRoot.querySelector('#' + refId);
and I'm guessing in your code somewhere, you have a ref="idName" where idName isn't found on the page. to see what's going on, you could put a breakpoint on https://github.com/Polymer/TemplateBinding/blob/2c379a393ee73a80eda4ad3b38f6ec6a064c89c9/src/TemplateBinding.js#L572 and see why it isn't finding the refId in the first query. Or try the patch above.
It's actually not finding a treeScope
in the first query, so it never looks for the element at #refId
.
John is right as usual. Fixed: https://github.com/Polymer/TemplateBinding/commit/5c5109f
I do have an element with the right id; it's just inside a custom element's template instead of at the document level. You can see this at http://jsbin.com/AmERAZIV/1/edit: if you take the <template bind="" id="hierarchy">
element and copy it to the document level, you'll see the hierarchy reappear.
@rafaelw's fix didn't fix this problem; it just hid it by removing the exception.
I can make this work with less duplication by moving the named template out of the template that produces shadow dom (http://jsbin.com/oGoporiC/1/edit), but if that's the intended interaction between template binding and custom elements, it should be documented.
Sorry, Jeffery. I think I've fixed it for good now: https://github.com/Polymer/TemplateBinding/commit/103de71
I tested your fix, and it appears to make my elements work. Thanks!
To reproduce, clone
git@github.com:cplusplus/fundamentals-ts.git
(at 8bb73e5b0), runbower update
, run a web server in that directory, and try to load/fundamentals-ts.html
. Something in https://github.com/cplusplus/fundamentals-ts/blob/master/elements/toc.html causes the following stack trace. The second.ref
gets to what I think is https://github.com/cplusplus/fundamentals-ts/blob/8bb73e5b05bf7f0770a149fb1b27cb6258bbefa0/elements/toc.html#L23, hits a #document-fragment with notemplateCreator_
orgetElementById()
, and dies.