Fix random.item to accomodate DOMStringList

This commit is contained in:
pyoor 2017-07-20 15:37:20 -04:00
parent a1aab62256
commit 2d36bb0739

View file

@ -50,7 +50,7 @@ var random = { // eslint-disable-line no-unused-vars
return Math.exp(this.float() * Math.log(limit))
},
item: function (list) {
if (list === undefined || typeof list === 'string' || !list.hasOwnProperty('length')) {
if (list === undefined || typeof list === 'string' || list.length === undefined) {
logger.traceback()
throw new TypeError('random.item() received an invalid object: \'' + list + '\'')
}