Skip to content

Commit

Permalink
[BUGFIX beta] reimplement $.ready()
Browse files Browse the repository at this point in the history
  • Loading branch information
rreckonerr committed Sep 19, 2020
1 parent af4253e commit a85242c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/@ember/application/lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,6 @@ const Application = Engine.extend({
// eslint-disable-line no-unused-vars
this._super(...arguments);

if (!this.$) {
this.$ = jQuery;
}

registerLibraries();

if (DEBUG) {
Expand Down Expand Up @@ -483,10 +479,15 @@ const Application = Engine.extend({
@method waitForDOMReady
*/
waitForDOMReady() {
if (!this.$ || this.$.isReady) {
if (!hasDOM || document.readyState !== 'loading') {
schedule('actions', this, 'domReady');
} else {
this.$().ready(bind(this, 'domReady'));
let callback = function() {
document.removeEventListener('DOMContentLoaded', callback);
this.domReady();
};

document.addEventListener('DOMContentLoaded', bind(this, callback));
}
},

Expand Down

0 comments on commit a85242c

Please sign in to comment.