Skip to content

Commit

Permalink
Merge pull request marmelab#52 from marmelab/empty_select
Browse files Browse the repository at this point in the history
[RFR] Fix RangeError when formFiller tries to fill empty select
  • Loading branch information
manuquentin committed Mar 27, 2014
2 parents af3b200 + 71ff92d commit cfbba3e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/species/formFiller.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ define(function(require) {
}
}

var character = config.elementMapTypes[elementType](element);
var value = config.elementMapTypes[elementType](element);

if (typeof config.showAction == 'function') {
config.showAction(element);
}

if (typeof config.logger.log == 'function') {
config.logger.log('gremlin', 'formFiller', 'input', character, 'in', element);
config.logger.log('gremlin', 'formFiller', 'input', value, 'in', element);
}
}

Expand All @@ -128,6 +128,7 @@ define(function(require) {

function fillSelect(element) {
var options = element.querySelectorAll('option');
if (options.length === 0) return;
var randomOption = config.randomizer.pick(options);

for (var i = 0, c = options.length; i < c; i++) {
Expand Down

0 comments on commit cfbba3e

Please sign in to comment.