summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-11-23 16:07:05 +0000
committerJacob Schatz <jschatz@gitlab.com>2016-11-23 16:07:05 +0000
commitc52f3d1ca0fede064e6b886af0297d1ae8f9f18b (patch)
treedd5066fbf2ebd06e1d853ebbbeb32c0975c1fbb4
parenta44c9b9e8e8dfbbc37056e812c3b263eb92b644b (diff)
parent56d2906293a9edb022449a214258d05e15471f83 (diff)
downloadgitlab-ce-c52f3d1ca0fede064e6b886af0297d1ae8f9f18b.tar.gz
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
-rw-r--r--app/assets/javascripts/lib/utils/custom_event_polyfill.js.es612
1 files changed, 12 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/custom_event_polyfill.js.es6 b/app/assets/javascripts/lib/utils/custom_event_polyfill.js.es6
new file mode 100644
index 00000000000..5ae978010c9
--- /dev/null
+++ b/app/assets/javascripts/lib/utils/custom_event_polyfill.js.es6
@@ -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;
+}