Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App booted before DOM ready without jQuery #19134

Closed
chancancode opened this issue Sep 8, 2020 · 1 comment · Fixed by #19142
Closed

App booted before DOM ready without jQuery #19134

chancancode opened this issue Sep 8, 2020 · 1 comment · Fixed by #19142

Comments

@chancancode
Copy link
Member

waitForDOMReady() {
if (!this.$ || this.$.isReady) {
schedule('actions', this, 'domReady');
} else {
this.$().ready(bind(this, 'domReady'));
}
},

Without jQuery, this code no longer works and boots the app immediately (as soon as the bundle is loaded, but possibly before DOM read).

Workaround for now using an initializer:

export function initialize(app) {
  if (document.readyState === 'loading') {
    app.deferReadiness();

    let callback = () => {
      if (document.readyState !== 'loading') {
        app.advanceReadiness();
        document.removeEventListener('readystatechange', callback);
      }
    };

    document.addEventListener('readystatechange', callback);
  }
}

export default {
  initialize
};

We should reimplement $.ready() without relying on jQuery.

@kanavpruthi
Copy link

I am a beginner at contributing and would like to work on an issue here.

@chancancode chancancode linked a pull request Sep 20, 2020 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants