summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2013-05-16 08:03:53 (GMT)
committerNathaniel Catchpole2013-05-16 08:03:53 (GMT)
commit39f3d34b42fcc2593ecdc3ab40b8d1f4147ef6a3 (patch)
tree365248e30b34d5bbecb0ec067927723b60332171
parent6fa50c64eb5bd5a765c89968b0725921ae777358 (diff)
Issue #1660952 by Jelle_S, RobLoach, seutje: Replace all jQuery.each() with filtered for loop.
-rw-r--r--core/modules/field_ui/field_ui.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/modules/field_ui/field_ui.js b/core/modules/field_ui/field_ui.js
index b4621e4..3000cd1 100644
--- a/core/modules/field_ui/field_ui.js
+++ b/core/modules/field_ui/field_ui.js
@@ -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);
});