Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Merge requests
!1262
Issue
#3239500
: Add Array.includes polyfill to support IE11 and Opera Mini
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3239500
: Add Array.includes polyfill to support IE11 and Opera Mini
issue/drupal-3239500:3239500-add-array.includes-polyfill
into
9.4.x
Overview
6
Commits
78
Pipelines
0
Changes
6
All threads resolved!
Show all comments
Open
Harumi Jang
requested to merge
issue/drupal-3239500:3239500-add-array.includes-polyfill
into
9.4.x
3 years ago
Overview
6
Commits
78
Pipelines
0
Changes
6
All threads resolved!
Show all comments
Expand
0
0
Merge request reports
Compare
9.4.x
version 9
374c85d7
3 years ago
version 8
374c85d7
3 years ago
version 7
079a1d9d
3 years ago
version 6
e6c24326
3 years ago
version 5
6fda5d83
3 years ago
version 4
2c6d4ffd
3 years ago
version 3
7b8ff025
3 years ago
version 2
476dc895
3 years ago
version 1
1e90f571
3 years ago
9.4.x (base)
and
latest version
latest version
babefb08
78 commits,
3 years ago
version 9
374c85d7
75 commits,
3 years ago
version 8
374c85d7
6 commits,
3 years ago
version 7
079a1d9d
7 commits,
3 years ago
version 6
e6c24326
6 commits,
3 years ago
version 5
6fda5d83
5 commits,
3 years ago
version 4
2c6d4ffd
4 commits,
3 years ago
version 3
7b8ff025
3 commits,
3 years ago
version 2
476dc895
2 commits,
3 years ago
version 1
1e90f571
1 commit,
3 years ago
6 files
+
112
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
core/misc/polyfills/array.includes.es6.js
0 → 100644
+
53
−
0
Options
/**
* @file
* Provides a polyfill for Array.includes().
*
* This is needed for Internet Explorer 11 and Opera Mini.
*
* This has based on MDN Web Docs code samples. Code samples in the MDN Web Docs
* are licensed under CC0.
*
* @see https://web.archive.org/web/20161012020930/https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
* @see https://developer.mozilla.org/en-US/docs/MDN/About#Code_samples_and_snippets
*/
if
(
!
Array
.
prototype
.
includes
)
{
// eslint-disable-next-line no-extend-native
Array
.
prototype
.
includes
=
function
(
searchElement
)
{
if
(
this
==
null
)
{
throw
new
TypeError
(
'
Array.prototype.includes called on null or undefined
'
,
);
}
const
O
=
Object
(
this
);
const
len
=
parseInt
(
O
.
length
,
10
)
||
0
;
if
(
len
===
0
)
{
return
false
;
}
// eslint-disable-next-line prefer-rest-params
const
n
=
parseInt
(
arguments
[
1
],
10
)
||
0
;
let
k
;
if
(
n
>=
0
)
{
k
=
n
;
}
else
{
k
=
len
+
n
;
if
(
k
<
0
)
{
k
=
0
;
}
}
let
currentElement
;
while
(
k
<
len
)
{
currentElement
=
O
[
k
];
if
(
searchElement
===
currentElement
||
// eslint-disable-next-line no-self-compare
(
searchElement
!==
searchElement
&&
currentElement
!==
currentElement
)
)
{
// NaN !== NaN
return
true
;
}
k
+=
1
;
}
return
false
;
};
}
Loading