[wp-trac] [WordPress Trac] #37265: underscorejs Escaping Issues

WordPress Trac noreply at wordpress.org
Mon Jul 4 08:23:07 UTC 2016


#37265: underscorejs Escaping Issues
--------------------------+-----------------------------
 Reporter:  casben79      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.5.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I am attempting to customise a WooCommerce single variation template which
 uses the WP underscore.js setup.

 The following is throwing a JS error: Uncaught SyntaxError: Unexpected
 token ) in underscores.min.js

 {{{
 <div class="attributes">

     {{{ _.each( data.variation.attribute_data, function(element, index,
 list) { }}}

         <span class="test">TEST</span>

     {{{ }); }}}

 </div>
 }}}


 If I change it to the following it works fine, I just need to escape into
 HTML for the templating.

 {{{
 <div class="attributes">

     {{{ _.each( data.variation.attribute_data, function(element, index,
 list) {

         console.log( element );

     }); }}}

 </div>
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37265>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list