Merge branch 'custom-event-polyfill' into 'master'
Adds polyfill for CustomEvent ## What does this MR do? CustomEvent is not supported by IE.- https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent In order to stop using jQuery in new files that need to listen to custom events we need this polyfill. ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [ ] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? See merge request !7705
This commit is contained in:
commit
c52f3d1ca0
1 changed files with 12 additions and 0 deletions
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* CustomEvent support for IE
|
||||
*/
|
||||
if (typeof window.CustomEvent !== 'function') {
|
||||
window.CustomEvent = function CustomEvent(e, params) {
|
||||
const options = params || { bubbles: false, cancelable: false, detail: undefined };
|
||||
const evt = document.createEvent('CustomEvent');
|
||||
evt.initCustomEvent(e, options.bubbles, options.cancelable, options.detail);
|
||||
return evt;
|
||||
};
|
||||
window.CustomEvent.prototype = window.Event.prototype;
|
||||
}
|
Loading…
Reference in a new issue