AutoComplete: render-reverse.patch

File render-reverse.patch, 1.7 kB (added by asjo, 2 years ago)
  • autocomplete.js

    old new  
    257257   
    258258  render: function() { 
    259259    if(this.entryCount > 0) { 
    260       for (var i = 0; i < this.entryCount; i++) 
    261         this.index==i ?  
    262           addElementClass(this.getEntry(i),"selected") : 
    263           removeElementClass(this.getEntry(i),"selected"); 
    264          
     260      for (var i = 0; i < this.entryCount; i++) { 
     261         if (this.getEntry(i).nodeName!='#text') { 
     262           this.index==i ?  
     263             addElementClass(this.getEntry(i),"selected") : 
     264             removeElementClass(this.getEntry(i),"selected"); 
     265         } 
     266      } 
    265267      if(this.hasFocus) {  
    266268        this.show(); 
    267269        this.active = true; 
     
    273275  }, 
    274276   
    275277  markPrevious: function() { 
    276     if(this.index > 0) this.index-- 
     278      if(this.index > 0) { 
     279         this.index--; 
     280         while (this.index>0 && this.getEntry(this.index).nodeName=='#text') { this.index--; } 
     281      } 
    277282      else this.index = this.entryCount-1; 
    278283  }, 
    279284   
    280285  markNext: function() { 
    281     if(this.index < this.entryCount-1) this.index++ 
     286      if(this.index < this.entryCount-1) { 
     287         this.index++; 
     288         while (this.index < this.entryCount-1 && this.getEntry(this.index).nodeName=='#text') { this.index++ } 
     289      } 
    282290      else this.index = 0; 
    283291  }, 
    284292   
     
    301309      return; 
    302310    } 
    303311     
    304     // the reverse, join is a workaround for a bug in the 1.1 version of MochiKit 
    305     // 
    306     var value = scrapeText(selectedElement, true).reverse().join(""); 
     312    var value = scrapeText(selectedElement, true).join(""); 
    307313 
    308314    var lastTokenPos = this.findLastToken(); 
    309315    if (lastTokenPos != -1) {