Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
016e7503
Commit
016e7503
authored
Oct 20, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix performance of sticky.js
Closes #39332
parent
5295f23b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
7 deletions
+3
-7
app/assets/javascripts/init_changes_dropdown.js
app/assets/javascripts/init_changes_dropdown.js
+1
-1
app/assets/javascripts/lib/utils/sticky.js
app/assets/javascripts/lib/utils/sticky.js
+2
-6
No files found.
app/assets/javascripts/init_changes_dropdown.js
View file @
016e7503
import
stickyMonitor
from
'
./lib/utils/sticky
'
;
import
stickyMonitor
from
'
./lib/utils/sticky
'
;
export
default
()
=>
{
export
default
()
=>
{
stickyMonitor
(
document
.
querySelector
(
'
.js-diff-files-changed
'
));
stickyMonitor
(
document
.
querySelector
(
'
.js-diff-files-changed
'
)
,
76
);
$
(
'
.js-diff-stats-dropdown
'
).
glDropdown
({
$
(
'
.js-diff-stats-dropdown
'
).
glDropdown
({
filterable
:
true
,
filterable
:
true
,
...
...
app/assets/javascripts/lib/utils/sticky.js
View file @
016e7503
...
@@ -28,14 +28,10 @@ export const isSticky = (el, scrollY, stickyTop, insertPlaceholder) => {
...
@@ -28,14 +28,10 @@ export const isSticky = (el, scrollY, stickyTop, insertPlaceholder) => {
}
}
};
};
export
default
(
el
,
insertPlaceholder
=
true
)
=>
{
export
default
(
el
,
stickyTop
,
insertPlaceholder
=
true
)
=>
{
if
(
!
el
)
return
;
if
(
!
el
)
return
;
const
computedStyle
=
window
.
getComputedStyle
(
el
);
if
(
typeof
CSS
===
'
undefined
'
||
!
(
CSS
.
supports
(
'
(position: -webkit-sticky) or (position: sticky)
'
)))
return
;
if
(
!
/sticky/
.
test
(
computedStyle
.
position
))
return
;
const
stickyTop
=
parseInt
(
computedStyle
.
top
,
10
);
document
.
addEventListener
(
'
scroll
'
,
()
=>
isSticky
(
el
,
window
.
scrollY
,
stickyTop
,
insertPlaceholder
),
{
document
.
addEventListener
(
'
scroll
'
,
()
=>
isSticky
(
el
,
window
.
scrollY
,
stickyTop
,
insertPlaceholder
),
{
passive
:
true
,
passive
:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment