Alternative question version: How to prevent HTML entities from being escaped, when added in the Polymer element definition?
So assume this simplified example (all includes of polymer libraries are added in the real code):
element definition
<polymer-element name="x-test" attributes="val">
<template>
<div>{{shownVal}}</div>
</template>
<script>
Polymer( 'x-test', {
shownVal: '',
valChanged: function(){
this.shownVal = this.val + ' &';
}
});
</script>
</polymer-element>
element usage
<x-test val="123"></x-test>
This will result in an output like this:
123 &
Version: Polymer 0.1.2
What do I need to change/add to have an output like 123 &?
Or is this some kind of bug, I should let the Polymer guys know about?
I know, that I could add the entity in the <template> and this would work, but I have some code, which modifies the input attributes and needs to use entities.
Note: If using the element like this
<x-test val="123 &"></x-test>
everything renders fine.
this.shownVal = this.val + ' &';– HBP Jan 11 '14 at 13:48&was just an example here. I want to insert other HTML entities and I don't want to use their character representation. – Sirko Jan 11 '14 at 13:53valChangedis converting any HTML special chars like & and < into their entity coding. See then answer to this : stackoverflow.com/questions/5796718/html-entity-decode if you absolutely have to pass HTML entities. – HBP Jan 11 '14 at 13:58