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
3f9129dd
Commit
3f9129dd
authored
Jun 08, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move svg4everybody into polyfills and reorganize
parent
fb81210b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
12 deletions
+21
-12
app/assets/javascripts/commons/polyfills.js
app/assets/javascripts/commons/polyfills.js
+1
-1
app/assets/javascripts/commons/polyfills/element.js
app/assets/javascripts/commons/polyfills/element.js
+15
-8
app/assets/javascripts/commons/polyfills/svg.js
app/assets/javascripts/commons/polyfills/svg.js
+5
-0
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-3
No files found.
app/assets/javascripts/commons/polyfills.js
View file @
3f9129dd
...
@@ -14,10 +14,10 @@ import 'core-js/es6/map';
...
@@ -14,10 +14,10 @@ import 'core-js/es6/map';
import
'
core-js/es6/weak-map
'
;
import
'
core-js/es6/weak-map
'
;
// Browser polyfills
// Browser polyfills
import
'
classlist-polyfill
'
;
import
'
formdata-polyfill
'
;
import
'
formdata-polyfill
'
;
import
'
./polyfills/custom_event
'
;
import
'
./polyfills/custom_event
'
;
import
'
./polyfills/element
'
;
import
'
./polyfills/element
'
;
import
'
./polyfills/event
'
;
import
'
./polyfills/event
'
;
import
'
./polyfills/nodelist
'
;
import
'
./polyfills/nodelist
'
;
import
'
./polyfills/request_idle_callback
'
;
import
'
./polyfills/request_idle_callback
'
;
import
'
./polyfills/svg
'
;
app/assets/javascripts/commons/polyfills/element.js
View file @
3f9129dd
Element
.
prototype
.
closest
=
Element
.
prototype
.
closest
||
// polyfill Element.classList and DOMTokenList with classList.js
import
'
classlist-polyfill
'
;
Element
.
prototype
.
closest
=
Element
.
prototype
.
closest
||
function
closest
(
selector
,
selectedElement
=
this
)
{
function
closest
(
selector
,
selectedElement
=
this
)
{
if
(
!
selectedElement
)
return
null
;
if
(
!
selectedElement
)
return
null
;
return
selectedElement
.
matches
(
selector
)
?
return
selectedElement
.
matches
(
selector
)
selectedElement
:
?
selectedElement
Element
.
prototype
.
closest
(
selector
,
selectedElement
.
parentElement
);
:
Element
.
prototype
.
closest
(
selector
,
selectedElement
.
parentElement
);
};
};
Element
.
prototype
.
matches
=
Element
.
prototype
.
matches
||
Element
.
prototype
.
matches
=
Element
.
prototype
.
matches
||
Element
.
prototype
.
matchesSelector
||
Element
.
prototype
.
matchesSelector
||
Element
.
prototype
.
mozMatchesSelector
||
Element
.
prototype
.
mozMatchesSelector
||
Element
.
prototype
.
msMatchesSelector
||
Element
.
prototype
.
msMatchesSelector
||
...
@@ -15,13 +20,15 @@ Element.prototype.matches = Element.prototype.matches ||
...
@@ -15,13 +20,15 @@ Element.prototype.matches = Element.prototype.matches ||
function
matches
(
selector
)
{
function
matches
(
selector
)
{
const
elms
=
(
this
.
document
||
this
.
ownerDocument
).
querySelectorAll
(
selector
);
const
elms
=
(
this
.
document
||
this
.
ownerDocument
).
querySelectorAll
(
selector
);
let
i
=
elms
.
length
-
1
;
let
i
=
elms
.
length
-
1
;
while
(
i
>=
0
&&
elms
.
item
(
i
)
!==
this
)
{
i
-=
1
;
}
while
(
i
>=
0
&&
elms
.
item
(
i
)
!==
this
)
{
i
-=
1
;
}
return
i
>
-
1
;
return
i
>
-
1
;
};
};
// From the polyfill on MDN, https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove#Polyfill
// From the polyfill on MDN, https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove#Polyfill
(
(
arr
)
=>
{
(
arr
=>
{
arr
.
forEach
(
(
item
)
=>
{
arr
.
forEach
(
item
=>
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
item
,
'
remove
'
))
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
item
,
'
remove
'
))
{
return
;
return
;
}
}
...
...
app/assets/javascripts/commons/polyfills/svg.js
0 → 100644
View file @
3f9129dd
import
svg4everybody
from
'
svg4everybody
'
;
// polyfill support for external SVG file references via <use xlink:href>
// @see https://css-tricks.com/svg-use-external-source/
svg4everybody
();
app/assets/javascripts/main.js
View file @
3f9129dd
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
import
jQuery
from
'
jquery
'
;
import
jQuery
from
'
jquery
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
svg4everybody
from
'
svg4everybody
'
;
// bootstrap webpack, common libs, polyfills, and behaviors
// bootstrap webpack, common libs, polyfills, and behaviors
import
'
./webpack
'
;
import
'
./webpack
'
;
...
@@ -41,8 +40,6 @@ if (process.env.NODE_ENV !== 'production' && gon && gon.test_env) {
...
@@ -41,8 +40,6 @@ if (process.env.NODE_ENV !== 'production' && gon && gon.test_env) {
import
(
/* webpackMode: "eager" */
'
./test_utils/
'
);
import
(
/* webpackMode: "eager" */
'
./test_utils/
'
);
}
}
svg4everybody
();
document
.
addEventListener
(
'
beforeunload
'
,
()
=>
{
document
.
addEventListener
(
'
beforeunload
'
,
()
=>
{
// Unbind scroll events
// Unbind scroll events
$
(
document
).
off
(
'
scroll
'
);
$
(
document
).
off
(
'
scroll
'
);
...
...
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