markbates/coffeebeans — Issue #6: escaping too much?
Author: fringd
Created: 2012-01-26 00:40:26+00:00
State: open

for some reason this:

```javascript
$('div.input table tr.attachment-row .remove_row').click()
<% if @project.portfolio %>
portfolio_id = '<%=escape_javascript @project.portfolio_id.to_s %>'
portfolio_name = '<%=escape_javascript @project.portfolio.name %>'
portfolio = $('#project_portfolio_id')
option = portfolio.find('option[value='+portfolio_id+']')
if option.length is 0
optionhtml = '
'+portfolio_name+'
'
portfolio.find('option').last().before(optionhtml)
portfolio.val(portfolio_id)
<% end %>
```

is rendering as this:

```javascript
/*snip*/

if (option.length === 0) {
optionhtml = '<option value=' + portfolio_id + '>' + portfolio_name + '</option>';
portfolio.find('option').last().before(optionhtml);
}

/*snip*/
```

not the problematic <, > also if i use the rubyish string evaluations ("foo#{var}bar...") it escapes my double quotes and i end up with invalid syntax... why!? is this coffee beans' fault?