Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jquery_update
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
jquery_update
Commits
0541afe8
Commit
0541afe8
authored
2 years ago
by
mustanggb
Committed by
Drew Webber
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3325927
by mcdruid, MustangGB: jQuery 3.3+ breaks autocomplete
parent
57b1861c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jquery_update.module
+24
-0
24 additions, 0 deletions
jquery_update.module
js/jquery_position.js
+34
-0
34 additions, 0 deletions
js/jquery_position.js
with
58 additions
and
0 deletions
jquery_update.module
+
24
−
0
View file @
0541afe8
...
...
@@ -59,6 +59,16 @@ function jquery_update_library() {
),
'version'
=>
'0.0.1'
,
);
$libraries
[
'jquery_update.position.fix'
]
=
array
(
'title'
=>
'jQuery Update Position Fix'
,
'js'
=>
array
(
drupal_get_path
(
'module'
,
'jquery_update'
)
.
'/js/jquery_position.js'
=>
array
(
'group'
=>
JS_THEME
,
'weight'
=>
2
,
),
),
'version'
=>
'0.0.1'
,
);
$libraries
[
'jquery.metadata'
]
=
array
(
'title'
=>
'QUnit'
,
'js'
=>
array
(
...
...
@@ -289,6 +299,7 @@ function jquery_update_jquery_replace(array &$javascript, $cdn, $path, $min, $ve
if
(
!
empty
(
$custom_version
))
{
$javascript
[
'jquery'
][
'version'
]
=
$custom_version
;
jquery_update_add_jquery_browser_fix
(
$javascript
,
$custom_version
);
jquery_update_add_jquery_position_fix
(
$javascript
,
$custom_version
);
}
return
;
}
...
...
@@ -343,6 +354,7 @@ function jquery_update_jquery_replace(array &$javascript, $cdn, $path, $min, $ve
break
;
}
jquery_update_add_jquery_browser_fix
(
$javascript
,
$version
);
jquery_update_add_jquery_position_fix
(
$javascript
,
$version
);
}
/**
...
...
@@ -357,6 +369,18 @@ function jquery_update_add_jquery_browser_fix(&$libraries, $jquery_version) {
}
}
/**
* Add a workaround for .position() behaviour change.
*/
function
jquery_update_add_jquery_position_fix
(
&
$libraries
,
$jquery_version
)
{
if
(
version_compare
(
$jquery_version
,
'3.3'
,
'>='
))
{
$libraries
[
'jquery'
][
'dependencies'
][]
=
array
(
'jquery_update'
,
'jquery_update.position.fix'
,
);
}
}
/**
* Add the local fallback in case jQuery from the CDN is unavailable.
*
...
...
This diff is collapsed.
Click to expand it.
js/jquery_position.js
0 → 100644
+
34
−
0
View file @
0541afe8
/**
* Workaround for .position() behaviour which was changed in jQuery 3.3
* @see https://github.com/jquery/api.jquery.com/issues/1081
*/
var
Drupal
=
Drupal
||
{};
(
function
(
$
,
Drupal
)
{
// Overload Drupal.jsAC.prototype.populatePopup
if
(
Drupal
.
jsAC
!==
undefined
&&
Drupal
.
jsAC
.
prototype
.
populatePopup
!==
undefined
)
{
Drupal
.
jsAC
.
prototype
.
populatePopup
=
function
()
{
var
$input
=
$
(
this
.
input
);
var
offset
=
$input
.
offset
();
var
offsetParent
=
$input
.
offsetParent
().
offset
();
// Show popup.
if
(
this
.
popup
)
{
$
(
this
.
popup
).
remove
();
}
this
.
selected
=
false
;
this
.
popup
=
$
(
'
<div id="autocomplete"></div>
'
)[
0
];
this
.
popup
.
owner
=
this
;
$
(
this
.
popup
).
css
({
top
:
parseInt
(
offset
.
top
-
offsetParent
.
top
+
this
.
input
.
offsetHeight
,
10
)
+
'
px
'
,
left
:
parseInt
(
offset
.
left
-
offsetParent
.
left
,
10
)
+
'
px
'
,
width
:
$input
.
innerWidth
()
+
'
px
'
,
display
:
'
none
'
});
$input
.
before
(
this
.
popup
);
// Do search.
this
.
db
.
owner
=
this
;
this
.
db
.
search
(
this
.
input
.
value
);
};
}
})(
jQuery
,
Drupal
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment