Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10035: change_index_param_to_value.diff

File change_index_param_to_value.diff, 1.1 kB (added by jdalton, 6 months ago)
  • C:/Inetpub/wwwroot/prototype/src/Copy

    old new  
    213213    else element.value = value; 
    214214  }, 
    215215   
    216   select: function(element, index) { 
    217     if (Object.isUndefined(index)) 
     216  select: function(element, value) { 
     217    if (Object.isUndefined(value)) 
    218218      return this[element.type == 'select-one' ?  
    219219        'selectOne' : 'selectMany'](element); 
    220220    else { 
    221       var opt, value, single = !Object.isArray(index); 
     221      var opt, optValue, single = !Object.isArray(value); 
    222222      for (var i = 0, length = element.length; i < length; i++) { 
    223223        opt = element.options[i]; 
    224         value = this.optionValue(opt); 
     224        optValue = this.optionValue(opt); 
    225225        if (single) { 
    226           if (value == index) { 
     226          if (optValue == value) { 
    227227            opt.selected = true; 
    228228            return; 
    229229          } 
    230230        } 
    231         else opt.selected = index.include(value); 
     231        else opt.selected = value.include(optValue); 
    232232      } 
    233233    } 
    234234  },