mardi 1 mars 2016

binding style attributes inside each-loop

I have this code:

    {{#each hotspots as |hotspot|}}
      {{#unless (eq hotspot.x_axis "")}}
        {{#if (eq categoryId hotspot.category)}}
          {{#draggable-item content=hotspot.id dragEnter=(action "setIsDragged" "isDragged") dragEnd=(action "setIsDragged" false)}}
            <div {{action 'showMarkerModal' hotspot.id}} class="normal-markers {{isDragged}}" style="position:absolute;top:{{{hotspot.y_axis}}}px;left:{{{hotspot.x_axis}}}px;"><i class="fa fa-map-marker {{isDragged}}"></i></div>
          {{/draggable-item}}
          <span style="position:absolute;top:{{{hotspot.y_axis}}}px;left:{{{hotspot.x_axis}}}px;">
          </span>
        {{/if}}
      {{/unless}}
    {{/each}}

Which gives me the following warning:

WARNING: Binding style attributes may introduce cross-site scripting vulnerabilities; please ensure that values being bound are properly escaped. For more information, including how to disable this warning, see http://ift.tt/1gF7OUZ.

I know why the warning is being thrown, but I can't figure out how to bind the inline attributes as the x_axis and y_axis are coming from inside the handlebars file itself. So I cant do a computed property to solve this.

Has anyone come across of this before and knows how to solve it?




Aucun commentaire:

Enregistrer un commentaire