diff --git a/core/field_dropdown.js b/core/field_dropdown.js index 7d34d39ed..06c46077b 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -246,9 +246,10 @@ Blockly.FieldDropdown.prototype.trimOptions_ = function() { var strings = []; for (var i = 0; i < options.length; i++) { var text = options[i][0]; - if (typeof text == 'string') { - strings.push(text); + if (typeof text != 'string') { + return; // No text splitting if there is an image in the list. } + strings.push(text); } var shortest = Blockly.shortestStringLength(strings); var prefixLength = Blockly.commonWordPrefix(strings, shortest); @@ -270,11 +271,9 @@ Blockly.FieldDropdown.prototype.trimOptions_ = function() { var newOptions = []; for (var i = 0; i < options.length; i++) { var text = options[i][0]; - if (typeof text == 'string') { - var value = options[i][1]; - text = text.substring(prefixLength, text.length - suffixLength); - newOptions[i] = [text, value]; - } + var value = options[i][1]; + text = text.substring(prefixLength, text.length - suffixLength); + newOptions[i] = [text, value]; } this.menuGenerator_ = newOptions; }; diff --git a/core/utils.js b/core/utils.js index 124ea1a6a..644757980 100644 --- a/core/utils.js +++ b/core/utils.js @@ -92,7 +92,7 @@ Blockly.hasClass_ = function(element, className) { /** * Bind an event to a function call. When calling the function, verifies that - * it belongs to the touch stream that is currently being processsed, and splits + * it belongs to the touch stream that is currently being processed, and splits * multitouch events into multiple events as needed. * @param {!Node} node Node upon which to listen. * @param {string} name Event name to listen to (e.g. 'mousedown').