Skip to content

Commit

Permalink
Fix primefaces#4036: Cleaned up fix for escaping.
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Sep 17, 2018
1 parent 4ea7a60 commit b108107
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,12 @@ protected void encodeOptions(FacesContext context, PickList pickList, List model
RendererUtils.encodeCheckbox(context, false);
}

writer.writeText(itemLabel, null);
if (pickList.isEscape()) {
writer.writeText(itemLabel, null);
}
else {
writer.write(itemLabel);
}
}

writer.endElement("li");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,13 @@ PrimeFaces.widget.PickList = PrimeFaces.widget.BaseWidget.extend({
list.children('.ui-picklist-item').each(function() {
var item = $(this),
itemValue = item.attr('data-item-value'),
itemLabel = item.attr('data-item-label') ? item.attr('data-item-label') : '',
itemLabel = item.attr('data-item-label') ? PrimeFaces.escapeHTML(item.attr('data-item-label')) : '',
option = $('<option selected="selected"></option>');

if ($this.cfg.escape) {
itemValue = PrimeFaces.escapeHTML(itemValue);
itemLabel = PrimeFaces.escapeHTML(itemLabel);
option.prop('value', itemValue).text(itemLabel);
} else {
option.prop('value', itemValue).html(itemLabel);
}
option.prop('value', itemValue).text(itemLabel);

input.append(option);
});
Expand Down

0 comments on commit b108107

Please sign in to comment.