Skip to content

Commit

Permalink
MDL-84324 core: Add jQuery compatibility for BS5
Browse files Browse the repository at this point in the history
You don’t need jQuery in Bootstrap 5, but it’s still possible to use our components with jQuery.
If Bootstrap detects jQuery in the window object, it’ll add all of our components in jQuery’s plugin system.
This allows you to do the following:
$('#myTooltip').tooltip('show')
  • Loading branch information
roland04 committed Feb 10, 2025
1 parent 69bcc25 commit 5052af4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/amd/build/first.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/amd/build/first.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lib/amd/src/first.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ $(document)
.bind("ajaxStop", function() {
M.util.js_complete('jq');
});

// TODO: MDL-84465 Final deprecation in 6.0.
// Attach jQuery to the window object for Bootstrap backwards compatibility.
// Bootstrap 5 is designed to be used without jQuery, but it’s still possible to use our components with jQuery.
// If Bootstrap detects jQuery in the window object it’ll add all of our components in jQuery’s plugin system.
window.jQuery = $;

0 comments on commit 5052af4

Please sign in to comment.