Test 2 is expected. Templates are intended to be inert so it makes sense that elements inside them do not upgrade. Upgrading these elements would be a performance penalty.
Test 4: I'm not sure this behavior is well defined, but I'm sure Dominic knows more. If it's not defined, perhaps we can post a spec bug. It does indeed seem convenient to me that these documents use the main document's element registry. Eventually, HTMLImports will be ideal for this. Right now polymer prevents upgrade inside imports because test 2 is not yet fully supported under native custom elements. On Tue, Feb 18, 2014 at 12:40 PM, Eric Bidelman <[email protected]> wrote: > TL;DR > To ajaxify pp.org, I've been trying to test custom elements in an XHR'd > document (e.g. xhr.responseType='document'). The elements don't pick up > their element definitions from the main document. Why? > --- > > I threw together http://jsbin.com/gaquyeha/1/edit to test when/where > custom elements are registered *and* upgraded. Some of the results are > surprising and I'm hoping someone can shed light. I also might be in crazy > town. > > View of the console from http://jsbin.com/gaquyeha/1/edit. > > TEST 1:<polymer-ajax> declared in main document runner-3.11.7.min.js:1 > ✔ not an HTMLUnknownElement runner-3.11.7.min.js:1 > ✔ go() is defined runner-3.11.7.min.js:1 > TEST 2: <polymer-ajax> in a <template> in the main document > runner-3.11.7.min.js:1 > ✔ not an HTMLUnknownElement runner-3.11.7.min.js:1 > ✘ go() is defined runner-3.11.7.min.js:1 > TEST 3: <polymer-ajax> in a newly created document runner-3.11.7.min.js:1 > ✔ not an HTMLUnknownElement runner-3.11.7.min.js:1 > ✔ go() is defined runner-3.11.7.min.js:1 > TEST 4: <polymer-ajax> in an XHR'd document runner-3.11.7.min.js:1 > ✘ not an HTMLUnknownElement runner-3.11.7.min.js:1 > ✘ go() is defined runner-3.11.7.min.js:1 > > TEST 1: Expected. > > TEST 2: according to > Dominic<http://www.polymer-project.org/discuss.html?place=msg%2Fpolymer-dev%2Fqkl8l3c_SUU%2FGBPs9uOEIk4J>, > custom elements in <template> are inert and don't pick up the definitions > in the main document. These results indicate polymer-ajax gets registered > but isn't upgraded. *Why*? > > TEST 3: Expected. > > TEST 4: an XHR'd document (e.g. xhr.responseType='document') doesn't pick > up the definitions and the elements are not upgraded. *Why*? > > Thanks, > Eric > > Follow Polymer on Google+: plus.google.com/107187849809354688692 > --- > You received this message because you are subscribed to the Google Groups > "Polymer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/polymer-dev/CACGqRCAyvD58tc_R15xGfAgr2MZPCHSYhcTaZYW1aFx36E-VhA%40mail.gmail.com > . > For more options, visit https://groups.google.com/groups/opt_out. > Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CA%2BrMWZjDnia%3DEu1owPoyrK9xTcK-Y0Rea1_YiV%2Br%3D072a9Y%3DVQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
