AutoComplete: render-reverse.patch
| File render-reverse.patch, 1.7 kB (added by asjo, 2 years ago) |
|---|
-
autocomplete.js
old new 257 257 258 258 render: function() { 259 259 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 } 265 267 if(this.hasFocus) { 266 268 this.show(); 267 269 this.active = true; … … 273 275 }, 274 276 275 277 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 } 277 282 else this.index = this.entryCount-1; 278 283 }, 279 284 280 285 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 } 282 290 else this.index = 0; 283 291 }, 284 292 … … 301 309 return; 302 310 } 303 311 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(""); 307 313 308 314 var lastTokenPos = this.findLastToken(); 309 315 if (lastTokenPos != -1) {
