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

calling jQuery.holdReady(false) without jQuery.holdReady() will trigger jQuery.ready() without DOMContentLoaded #3287

Closed
stevemao opened this issue Aug 22, 2016 · 2 comments

Comments

@stevemao
Copy link
Contributor

stevemao commented Aug 22, 2016

Description

I have an app that assuming jQuery.holdReady() is called. So I can call jQuery.holdReady(false) whenever I'm ready. The problem is DOMContentLoaded is probably not triggered yet. Do you guys consider this as a bug? Also readyWait: 1, as a initially value is probably not intuitive. If we treat this as a bug I think the code would look better without this magic number :)

Bug Reports:
Note that we only can fix bugs in the latest (1.x, 2.x, 3.x) versions of jQuery.
Briefly describe the issue you've encountered

  • What do you expect to happen?

Calling jQuery.holdReady(false) without calling jQuery.holdReady() should not trigger jQuery.ready() if dom is actually not ready.

  • What acually happens?

Calling jQuery.holdReady(false) without calling jQuery.holdReady() triggering jQuery.ready() and jQuery actually think dom is ready.

I was going backward and forward whether I should open an issue. But I can totally provide a test case for this.

@gibson042
Copy link
Member

http://api.jquery.com/jQuery.holdReady/ is pretty clear on jQuery.holdReady being an advanced feature, and on proper use consisting of jQuery.holdReady( true ) followed by jQuery.holdReady( false ). Not only that, but we have decided to deprecate it entirely as suggested in #1778 (comment) .

I'm closing this for now, but if anyone considers it a mistake please post here and we'll consider reopening. But regardless, I recommend replacing uses of the functionality with jQuery.when( jQuery.ready, jQuery.Deferred( waitForMyDependencies ) ) as suggested in #2850 (comment) .

@stevemao
Copy link
Contributor Author

Sounds good. Thanks @gibson042 :)

@lock lock bot locked as resolved and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants