diff options
author | marijus <mario@mariovavti.com> | 2015-01-22 02:34:57 +0100 |
---|---|---|
committer | marijus <mario@mariovavti.com> | 2015-01-22 02:34:57 +0100 |
commit | 200220ff367af9aab6b19a64ec259f5eb68efbea (patch) | |
tree | e7e5966879cb5ea448ac42c658eda32eebb25e54 /library/jquery-textcomplete/jquery.textcomplete.js | |
parent | 4ff71fc0c7d28b8a843cc67eac1d9463afe575ee (diff) | |
parent | 503047dc327a514563a1be64bba163100af5cdec (diff) | |
download | volse-hubzilla-200220ff367af9aab6b19a64ec259f5eb68efbea.tar.gz volse-hubzilla-200220ff367af9aab6b19a64ec259f5eb68efbea.tar.bz2 volse-hubzilla-200220ff367af9aab6b19a64ec259f5eb68efbea.zip |
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'library/jquery-textcomplete/jquery.textcomplete.js')
-rw-r--r-- | library/jquery-textcomplete/jquery.textcomplete.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/library/jquery-textcomplete/jquery.textcomplete.js b/library/jquery-textcomplete/jquery.textcomplete.js index c8303eaa0..3df84f3b4 100644 --- a/library/jquery-textcomplete/jquery.textcomplete.js +++ b/library/jquery-textcomplete/jquery.textcomplete.js @@ -124,9 +124,8 @@ if (typeof jQuery === 'undefined') { this.views = []; this.option = $.extend({}, Completer._getDefaults(), option); - if (!this.$el.is('input[type=text]') && !this.$el.is('textarea') && !element.isContentEditable && element.contentEditable != 'true') { - throw new Error('textcomplete must be called on a input[type=text], Textarea or a ContentEditable.'); + throw new Error('textcomplete must be called on a Textarea or a ContentEditable.'); } if (element === document.activeElement) { @@ -414,6 +413,22 @@ if (typeof jQuery === 'undefined') { setPosition: function (position) { this.$el.css(this._applyPlacement(position)); + + // Make the dropdown fixed if the input is also fixed + // This can't be done during init, as textcomplete may be used on multiple elements on the same page + // Because the same dropdown is reused behind the scenes, we need to recheck every time the dropdown is showed + var position = 'absolute'; + // Check if input or one of its parents has positioning we need to care about + this.$inputEl.add(this.$inputEl.parents()).each(function() { + if($(this).css('position') === 'absolute') // The element has absolute positioning, so it's all OK + return false; + if($(this).css('position') === 'fixed') { + position = 'fixed'; + return false; + } + }); + this.$el.css({ position: position }); // Update positioning + return this; }, |