aboutsummaryrefslogtreecommitdiffstats
path: root/library/jquery-textcomplete/jquery.textcomplete.js
diff options
context:
space:
mode:
authorRedMatrix <info@friendica.com>2015-01-22 08:54:43 +1100
committerRedMatrix <info@friendica.com>2015-01-22 08:54:43 +1100
commitf7c88c99b0f77c81f14e3034489f7ad8e75b5cfe (patch)
tree5062c6eb7c8a4be7579d7535e9827a30575a4ff0 /library/jquery-textcomplete/jquery.textcomplete.js
parent2757da433e99fda4368ce07f4f44a0e59a5dd45e (diff)
parent84833ca15ec39e85d8c39457f0bb850a0a22525f (diff)
downloadvolse-hubzilla-f7c88c99b0f77c81f14e3034489f7ad8e75b5cfe.tar.gz
volse-hubzilla-f7c88c99b0f77c81f14e3034489f7ad8e75b5cfe.tar.bz2
volse-hubzilla-f7c88c99b0f77c81f14e3034489f7ad8e75b5cfe.zip
Merge pull request #873 from pafcu/master
Update some external libraries
Diffstat (limited to 'library/jquery-textcomplete/jquery.textcomplete.js')
-rw-r--r--library/jquery-textcomplete/jquery.textcomplete.js19
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;
},