Fixed checkCursorTag and checkCursorMenu not calculate doc height properly, fixed jquery-textcomplete support upSideDown

This commit is contained in:
Wu Cheng-Han 2015-09-25 13:39:08 +08:00
parent c4c9c4fed6
commit f8b029b2f4
2 changed files with 35 additions and 25 deletions

View file

@ -554,10 +554,16 @@ if (typeof jQuery === 'undefined') {
if (!this.shown) { return; }
if (this.isUp(e)) {
e.preventDefault();
this._up();
if(typeof upSideDown != 'undefined' && upSideDown)
this._down();
else
this._up();
} else if (this.isDown(e)) {
e.preventDefault();
this._down();
if(typeof upSideDown != 'undefined' && upSideDown)
this._up();
else
this._down();
} else if (this.isEnter(e)) {
e.preventDefault();
this._enter();
@ -633,7 +639,7 @@ if (typeof jQuery === 'undefined') {
},
_getActiveElement: function () {
return this.$el.children('.textcomplete-item:nth(' + this._index + ')');
return this.$el.children('.textcomplete-item[data-index=' + this._index + ']');
},
_setScroll: function () {
@ -661,20 +667,11 @@ if (typeof jQuery === 'undefined') {
this.data.push(datum);
item.push(datum.strategy.template(datum.value));
}
if(typeof upSideDown != 'undefined' && upSideDown) {
for (i = item.length - 1; i >= 0; i--) {
html += '<li class="textcomplete-item" data-index="' + i + '"><a>';
html += item[i];
html += '</a></li>';
}
this._index = this.data.length - 1;
} else {
for (i = 0; i < item.length; i++) {
for (i = 0; i < item.length; i++) {
html += '<li class="textcomplete-item" data-index="' + i + '"><a>';
html += item[i];
html += '</a></li>';
}
}
}
return html;
},