Commit 39f3d34b authored by catch's avatar catch

Issue #1660952 by Jelle_S, RobLoach, seutje: Replace all jQuery.each() with filtered for loop.

parent 6fa50c64
......@@ -96,12 +96,14 @@ jQuery.fn.fieldUIPopulateOptions = function (options, selected) {
var previousSelectedText = this.options[this.selectedIndex].text;
var html = '';
jQuery.each(options, function (value, text) {
// Figure out which value should be selected. The 'selected' param
// takes precedence.
var is_selected = ((typeof selected !== 'undefined' && value === selected) || (typeof selected === 'undefined' && text === previousSelectedText));
html += '<option value="' + value + '"' + (is_selected ? ' selected="selected"' : '') + '>' + text + '</option>';
});
for (var value in options) {
if (options.hasOwnProperty(value)) {
// Figure out which value should be selected. The 'selected' param
// takes precedence.
var is_selected = ((typeof selected !== 'undefined' && value === selected) || (typeof selected === 'undefined' && options[value] === previousSelectedText));
html += '<option value="' + value + '"' + (is_selected ? ' selected="selected"' : '') + '>' + options[value] + '</option>';
}
}
$(this).html(html).prop('disabled', disabled);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment