How to inject HTML into a template with polymer

前端 未结 3 1824
情话喂你
情话喂你 2020-11-27 06:42

I\'m using polymer-jsonp to perform JSONP requests, but the response sometimes contains html.

For example, supposing that post.content is \"Foo&l

3条回答
  •  抹茶落季
    2020-11-27 07:23

    Polymer will not stamp unescaped HTML via data-binding because it becomes a vulnerability for XSS attacks.

    There are talks ongoing about making it possible to stamp HTML under limited circumstance, or to allow for customized filtering, but this is not implemented yet at the data layer.

    It is possible to do what you want today using an additional custom element, but again, be advised of the potential for bad things to happen if you render untrusted HTML into your page.

    Here is an example that shows this technique:

    http://jsbin.com/durajiwo/1/edit

提交回复
热议问题