Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Doc injectBoundHTML() for .innerHTML'ing #607

Closed
ebidel opened this issue Aug 18, 2014 · 10 comments · Fixed by #820
Closed

Doc injectBoundHTML() for .innerHTML'ing #607

ebidel opened this issue Aug 18, 2014 · 10 comments · Fixed by #820
Assignees

Comments

@ebidel
Copy link
Contributor

ebidel commented Aug 18, 2014

There's a new injectBoundHTML on all polymer elements that is useful for .innerHTMLing markup into a container element. It picks up the bindings

/**
 * Inject HTML which contains markup bound to this element into
 * a target element (replacing target element content).
 * @param String html to inject
 * @param Element target element
 */
injectBoundHTML: function(html, element)

Example and explanation: http://stackoverflow.com/a/25434691/274673

Demo: http://jsbin.com/kacokevitabe/1/edit

We should also update this FAQ entry: http://www.polymer-project.org/resources/faq.html#setinnerHTML

@addyosmani
Copy link
Member

Quick demo from Steve: http://jsbin.com/menero/1/edit - this change is pretty awesome. Looking forward to it being documented.

@ebidel ebidel changed the title FAQ: add instanceTemplate example...adds sugaring to dynamically created nodes Doc instanceTemplate / injectBountHTML Aug 22, 2014
@ebidel ebidel changed the title Doc instanceTemplate / injectBountHTML Doc injectBountHTML for .innerHTML'ing Aug 22, 2014
@ebidel ebidel changed the title Doc injectBountHTML for .innerHTML'ing Doc injectBountHTM()L for .innerHTML'ing Aug 22, 2014
@ebidel ebidel changed the title Doc injectBountHTM()L for .innerHTML'ing Doc injectBountHTM() for .innerHTML'ing Aug 22, 2014
@ebidel ebidel changed the title Doc injectBountHTM() for .innerHTML'ing Doc injectBountHTML() for .innerHTML'ing Aug 22, 2014
@ebidel ebidel changed the title Doc injectBountHTML() for .innerHTML'ing Doc injectBoundHTML() for .innerHTML'ing Aug 22, 2014
@ebidel
Copy link
Contributor Author

ebidel commented Aug 22, 2014

Updated this issue with injectBoundHTML. That calls and does the instanceTemplate() trick. I don't think we need to document the latter.

Source is https://github.com/Polymer/polymer-dev/blob/3acc3c6a9e1db01cf403b80a210e9aee92a20b03/src/instance/utils.js#L96

@ebidel
Copy link
Contributor Author

ebidel commented Sep 22, 2014

@arthurevans can we prioritize this? I lot of people ask about it.

@ebidel
Copy link
Contributor Author

ebidel commented Dec 6, 2014

@marycampione @arthurevans Can this one make it to the docs soon? It's a fairly common question that people are still asking about on SO. They're linking to this issue :(

@RuedigerMoeller
Copy link

Is there any way to emulate this with 1.0 . Template customizing is a very common use case when rendering collections

@perdona
Copy link

perdona commented Oct 26, 2015

Same issue here, need to render html dynamically (stored on db) on a dom-repeat and polymer keeps holding me back.. =\

edit: polymer 1.0

@k7moorthi
Copy link

+1

3 similar comments
@dioptre
Copy link

dioptre commented Feb 24, 2016

+1

@atulkshirsagar
Copy link

+1

@adaptivefrog
Copy link

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants