BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
016e7503
Unverified
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
7 deletions
+3
-7
init_changes_dropdown.js
app/assets/javascripts/init_changes_dropdown.js
+1
-1
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'
;
export
default
()
=>
{
stickyMonitor
(
document
.
querySelector
(
'.js-diff-files-changed'
));
stickyMonitor
(
document
.
querySelector
(
'.js-diff-files-changed'
)
,
76
);
$
(
'.js-diff-stats-dropdown'
).
glDropdown
({
filterable
:
true
,
...
...
app/assets/javascripts/lib/utils/sticky.js
View file @
016e7503
...
...
@@ -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
;
const
computedStyle
=
window
.
getComputedStyle
(
el
);
if
(
!
/sticky/
.
test
(
computedStyle
.
position
))
return
;
const
stickyTop
=
parseInt
(
computedStyle
.
top
,
10
);
if
(
typeof
CSS
===
'undefined'
||
!
(
CSS
.
supports
(
'(position: -webkit-sticky) or (position: sticky)'
)))
return
;
document
.
addEventListener
(
'scroll'
,
()
=>
isSticky
(
el
,
window
.
scrollY
,
stickyTop
,
insertPlaceholder
),
{
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