You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although Bootstrap does not need jQuery anymore, it is still possible to use it in Moodle. See MDL-84324 for more information.
671
671
672
672
:::
673
+
674
+
## BS4 backwards-compatibility layer
675
+
676
+
The migration from Bootstrap 4 to Bootstrap 5 involves a transition period to allow third-party plugins to update gradually.
677
+
To facilitate this, a backwards-compatibility layer has been created, ensuring that some Bootstrap 4 syntax will continue to function until final deprecation in Moodle 6.0.
678
+
This approach aims to provide developers with sufficient time to adapt their code to the new Bootstrap 5 framework.
679
+
680
+
The BS4 backwards-compatibility layer encompasses three crucial aspects to facilitate a smooth transition for third-party contributions:
681
+
682
+
1.**Bootstrap jQuery support**: This allows existing plugins and components that rely on jQuery to continue functioning while developers work on updating their code to the new vanilla JavaScript approach.
683
+
2.**SCSS helpers and utilities**: The compatibility layer includes some SCSS helpers and utilities from Bootstrap 4, enabling developers to gradually adapt their custom styles to the new Bootstrap 5.
684
+
3.**Bootstrap 4 old data attributes syntax silent replacement**: This feature quietly replaces the old Bootstrap 4 data attribute syntax with the new Bootstrap 5 syntax, ensuring that existing markup continues to work without immediate changes.
685
+
686
+
### Bootstrap 4 old data attributes syntax silent replacement
687
+
688
+
<Sinceversion="5.0"issueNumber="MDL-84450" />
689
+
690
+
To minimize immediate breaking changes, the backwards-compatibility layer implements a silent replacement mechanism for Bootstrap 4's data attribute syntax.
691
+
692
+
As per Bootstrap's migration guide "*Data attributes for all JavaScript plugins are now namespaced to help distinguish Bootstrap functionality from third parties and your own code. For example, we use `data-bs-toggle` instead of `data-toggle`.*"
693
+
694
+
This feature automatically translates old data attributes to their Bootstrap 5 equivalents, allowing existing markup to function without requiring immediate updates.
695
+
This will replace for example `data-toggle="tooltip"` with `data-bs-toggle="tooltip"`, or `data-target="#collapsableContent"` with `data-bs-target="#collapsableContent"`.
696
+
697
+
:::warning
698
+
699
+
Dynamic generated content containing old data attributes syntax will not be replaced.
0 commit comments