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

Order of jQuery/popper file includes backwards #30873

Closed
catchmyfame opened this issue May 20, 2020 · 6 comments
Closed

Order of jQuery/popper file includes backwards #30873

catchmyfame opened this issue May 20, 2020 · 6 comments

Comments

@catchmyfame
Copy link

On the page https://getbootstrap.com/docs/4.5/getting-started/download/#bootstrapcdn it says:

If you’re using our compiled JavaScript, don’t forget to include CDN versions of jQuery and Popper.js before it.

It then shows an example of

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>

See the issue? The example shows popper after jQuery, but the docs say it should come before it.

The error appears to exist in the description, and not the example. I suggest changing:

If you’re using our compiled JavaScript, don’t forget to include CDN versions of jQuery and Popper.js before it.

to:

If you’re using our compiled JavaScript, don’t forget to include CDN versions of jQuery and Popper.js after it.

@ffoodd
Copy link
Member

ffoodd commented May 20, 2020

The wording might be confusing but the examples are right: "it" at the end of the sentence refers to "our compiled JavaScript", not jQuery.

Not sure about the best way to make this less confusing, though.

@catchmyfame
Copy link
Author

The wording might be confusing but the examples are right: "it" at the end of the sentence refers to "our compiled JavaScript", not jQuery.

Not sure about the best way to make this less confusing, though.

Right, that's my point, the grammar/wording is misleading and should be changed. I'm not an English major but it seems like a dangling participle. If the above suggestion doesn't seem more clear, then how about:

If you’re using our compiled JavaScript, don’t forget to include the CDN versions of jQuery followed by Popper.js.

Or perhaps:

If you’re using our compiled JavaScript, don’t forget to include the CDN versions of jQuery and Popper.js, in that order.

@ffoodd
Copy link
Member

ffoodd commented May 20, 2020

So I've been even more confusing I guess!

The order of jQuery and Popper.js doesn't matter: the sentence is meant to tell that both should come before our compiled JavaScript.

So both of those will work fine:

  1. jQuery, Popper.js, Bootstrap
  2. Popper.js, jQuery, Bootstrap

@mc2002tii
Copy link

It seems pretty clear to me that 'it' refers to 'our compiled JavaScript' and not 'jQuery,' especially with the example there. I suppose you could change 'before it' to 'first' to remove any possible ambiguity.

@XhmikosR
Copy link
Member

The order only matters in what @ffoodd said #30873 (comment)

The rest are common script inclusion principles. The order matters if the next script depends on another one, but that's not the case with jQuery and popper. We depend on jQuery and popper.

This reminds me, we should redo all the getting started snippets to mention our bundle. That's what most people should use.

@XhmikosR
Copy link
Member

Fixed in #30896

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants