diff --git a/ghost/admin/app/components/gh-activating-list-item.js b/ghost/admin/app/components/gh-activating-list-item.js index ae565939f3..08d8e93200 100644 --- a/ghost/admin/app/components/gh-activating-list-item.js +++ b/ghost/admin/app/components/gh-activating-list-item.js @@ -16,6 +16,6 @@ export default Component.extend({ }, click() { - this.$('a').blur(); + this.element.querySelector('a').blur(); } }); diff --git a/ghost/admin/app/components/gh-dropdown.js b/ghost/admin/app/components/gh-dropdown.js index 14e8774992..9234dd2713 100644 --- a/ghost/admin/app/components/gh-dropdown.js +++ b/ghost/admin/app/components/gh-dropdown.js @@ -25,21 +25,30 @@ export default Component.extend(DropdownMixin, { }), didInsertElement() { - let dropdownService = this.dropdown; - this._super(...arguments); + let dropdownService = this.dropdown; dropdownService.on('close', this, this.close); dropdownService.on('toggle', this, this.toggle); + + this._animationEndHandler = run.bind(this, function (event) { + if (event.animationName === 'fade-out' && this.closing) { + this.set('isOpen', false); + this.set('closing', false); + } + }); + + this.element.addEventListener('animationend', this._animationEndHandler); }, willDestroyElement() { - let dropdownService = this.dropdown; - this._super(...arguments); + let dropdownService = this.dropdown; dropdownService.off('close', this, this.close); dropdownService.off('toggle', this, this.toggle); + + this.element.removeEventListener('animationend', this._animationEndHandler); }, open() { @@ -54,17 +63,6 @@ export default Component.extend(DropdownMixin, { if (this.button) { this.set('button.isOpen', false); } - - this.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', (event) => { - if (event.originalEvent.animationName === 'fade-out') { - run(this, function () { - if (this.closing) { - this.set('isOpen', false); - this.set('closing', false); - } - }); - } - }); }, // Called by the dropdown service when any dropdown button is clicked. diff --git a/ghost/admin/app/components/gh-file-upload.js b/ghost/admin/app/components/gh-file-upload.js index 2c58c39c66..8660fe8764 100644 --- a/ghost/admin/app/components/gh-file-upload.js +++ b/ghost/admin/app/components/gh-file-upload.js @@ -24,7 +24,7 @@ export default Component.extend({ // Reset form if (this.shouldResetForm) { - this.$().closest('form')[0].reset(); + this.element.closest('form').reset(); } } }, diff --git a/ghost/admin/app/components/gh-markdown-editor.js b/ghost/admin/app/components/gh-markdown-editor.js index 2207317bd2..de70d57009 100644 --- a/ghost/admin/app/components/gh-markdown-editor.js +++ b/ghost/admin/app/components/gh-markdown-editor.js @@ -613,7 +613,7 @@ export default Component.extend(ShortcutsMixin, { // trigger the dialog via gh-file-input, when a file is selected it will // trigger the onImageFilesSelected closure action - this.$('input[type="file"]').click(); + this.element.querySelector('input[type="file"]').click(); }, // wrap SimpleMDE's built-in preview toggle so that we can trigger a closure diff --git a/ghost/admin/app/components/gh-notification.js b/ghost/admin/app/components/gh-notification.js index bda5cc041f..1edd689350 100644 --- a/ghost/admin/app/components/gh-notification.js +++ b/ghost/admin/app/components/gh-notification.js @@ -1,5 +1,6 @@ import Component from '@ember/component'; import {computed} from '@ember/object'; +import {run} from '@ember/runloop'; import {inject as service} from '@ember/service'; export default Component.extend({ @@ -32,16 +33,18 @@ export default Component.extend({ didInsertElement() { this._super(...arguments); - this.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', (event) => { + this._animationEndHandler = run.bind(this, function () { if (event.originalEvent.animationName === 'fade-out') { this.notifications.closeNotification(this.message); } }); + + this.element.addEventListener('animationend', this._animationEndHandler); }, willDestroyElement() { this._super(...arguments); - this.$().off('animationend webkitAnimationEnd oanimationend MSAnimationEnd'); + this.element.removeEventListener('animationend', this._animationEndHandler); }, actions: { diff --git a/ghost/admin/app/components/gh-task-button.js b/ghost/admin/app/components/gh-task-button.js index b9f609706a..670f461242 100644 --- a/ghost/admin/app/components/gh-task-button.js +++ b/ghost/admin/app/components/gh-task-button.js @@ -150,9 +150,8 @@ const GhTaskButton = Component.extend({ // so we want to restart the retry spinner animation to show something // has happened when the button is clicked _restartAnimation: task(function* () { - if (this.$('.retry-animated').length) { - // eslint-disable-next-line - let elem = this.$('.retry-animated')[0]; + let elem = this.element.querySelector('.retry-animated'); + if (elem) { elem.classList.remove('retry-animated'); yield timeout(10); elem.classList.add('retry-animated'); diff --git a/ghost/admin/app/components/modal-upload-image.js b/ghost/admin/app/components/modal-upload-image.js index 46dcdd776e..737c5859db 100644 --- a/ghost/admin/app/components/modal-upload-image.js +++ b/ghost/admin/app/components/modal-upload-image.js @@ -70,9 +70,9 @@ export default ModalComponent.extend({ _setErrorState(state) { if (state) { - this.$('.url').addClass('error'); + this.element.querySelector('.url').classList.add('error'); } else { - this.$('.url').removeClass('error'); + this.element.querySelector('.url').classList.remove('error'); } }, diff --git a/ghost/admin/config/deprecation-workflow.js b/ghost/admin/config/deprecation-workflow.js index 5fbc0f0b9a..11c91d8841 100644 --- a/ghost/admin/config/deprecation-workflow.js +++ b/ghost/admin/config/deprecation-workflow.js @@ -1,6 +1,7 @@ self.deprecationWorkflow = self.deprecationWorkflow || {}; self.deprecationWorkflow.config = { workflow: [ + // revert one liquid-fire and liquid-wormhole remove uses of `this.$()` {handler: 'silence', matchId: 'ember-views.curly-components.jquery-element'}, // revert once ember-infinity removes usage of `isVisible` // https://github.com/ember-infinity/ember-infinity/pull/399