SanomaCZ / ella-hope

Brand new admin for Ella 3+
Other
3 stars 0 forks source link

ternery operator produces invalid HTML inside elements #43

Closed yedpodtrzitko closed 11 years ago

yedpodtrzitko commented 11 years ago

(extra spacing next to quotes/apostrophes added for clarity)

steps to reproduce:

write some ternary operator with apostrophe in output:

<input type="text" <%= (1==1) ? "name= ' if ' " : "name= ' else ' " %> />

expected result:

<input type="text" name= ' if ' />

current result:

<input type="text" name=" ' if ' " />

mrpohoda commented 11 years ago

On which element did you find invalid HTML markup? It should be rendered correctly and if I check i.e. authors select when editing an article, HTML is correct (see selected="selected").

<select name="authors[]" data-placeholder="Choose authors" class="chzn-select authors-article authors chzn-done" multiple="" id="selY3Y" style="display: none; ">
    <option value="/admin-api/author/1/" selected="selected">test</option>
    <option value="/admin-api/author/2/">VandaGabi</option>
    <option value="/admin-api/author/3/">Jan Liška</option>
</select>

This was generated using

<option value="<%= a.resource_uri %>" <%= selected ? "selected=selected" : "" %>><%= a.name %></option>
yedpodtrzitko commented 11 years ago

Yes, but as you can see I pasted code, where the value is encapsulated in apostrophes. Your example code doesn't have them (which produces valid HTML, yes).

Code with apostrophes is used in list-photos-items.ejs