Skip to content

Commit

Permalink
fix(treeview): load jQuery migrate if used jQuery version is >= 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Severin Hauser committed Jan 10, 2023
1 parent e48d9be commit 36d6167
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions javascript/TreeView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
(function($) {
// Silverstripe <= 4.12 use jQuery 3.6 which breaks jQuery UI's 'dialog' function.
// If we detect a jQuery version > 3, we lazy load jQuery migrate
if ($().jquery.startsWith('3')) {
const migrateScript = document.createElement('script');
migrateScript.src = 'https://code.jquery.com/jquery-migrate-3.4.0.min.js';
document.body.appendChild(migrateScript);
}

function TreeViewContextMenu() {
this.createDom = function(id, name) {
this.$menu = $(
Expand Down

0 comments on commit 36d6167

Please sign in to comment.