javascript - Inserting content containing Custom Elements asynchronously -



javascript - Inserting content containing Custom Elements asynchronously -

there this question , this question, although both questions trigger same errors, solutions , causes not same. have tag that's loading content asynchronously throughout lifetime of app. content in turn contains custom elements causing error. below simplest test case reproduce error (assuming polymer installed bower, otherwise imports different):

base.html

<link rel="import" href="bower_components/polymer/polymer.html"> <link href="asynchronoustag.html" rel="import"> <asynchronous-tag></asynchronous-tag>

asynchronoustag.html

<link rel="import" href="bower_components/polymer/polymer.html"> <link rel="import" href="bower_components/core-tooltip/core-tooltip.html"> <polymer-element name="asynchronous-tag"> <template> <div id="text"></div> </template> <script> polymer({ ready:function(){ var = this; settimeout(function(){ that.$.text.innerhtml = '<core-tooltip label="testing">tester</core-tooltip>'; }, 2500); } }); </script> </polymer-element>

triggers error

attributes on core-tooltip info bound prior polymer upgrading element. may result in wrong binding types.

despite working expected. same happens when <core-tooltip> attribute-less well. not happen when inserting same node using

var ct = document.createelement("core-tooltip"); ct.innerhtml = "html"; ct.setattribute("label","text"); that.$.text.appendchild(ct);

which sadly doesn't help me much content total html string.

the reason concerned performance of function in question sub-par, hoping resolving problem that's causing error might improve (aside of fact i'd prefer not showing errors on console).

after finishing writing question browsing polymer mailing grouping , came across this mailing. in it said that

however element.innerhtml doesn't trigger lifecycle callbacks , didn't upgraded.

in other words, solution is

var div = document.createelement("div"); div.innerhtml = '<core-tooltip>tester</core-tooltip>'; that.$.text.appendchild(div.childnodes[0]);

and yes, makes no sense @ all... why sharing world after all.

javascript html polymer

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -