Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for jQuery 3
Browse files Browse the repository at this point in the history
$(document).on("ready", handler) was deprecated in jQuery 1.8 and
removed in 3
taylor-steve committed Jul 19, 2024
1 parent a93442b commit 9b372e3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/assets/javascripts/openseadragon/rails.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
$('picture[data-openseadragon]').openseadragon();
}

var handler = 'ready';
let handler = 'ready';
if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
// Turbolinks 5
if (Turbolinks.BrowserAdapter) {
@@ -15,5 +15,11 @@
handler = 'page:load ready';
}
}
$(document).on(handler, initOpenSeadragon);

// $(document).on( "ready", handler ) was removed in jQuery 3
if (handler !== 'ready' || parseInt($.fn.jquery.split('.')[0]) < 3) {
$(document).on(handler, initOpenSeadragon);
} else {
$(initOpenSeadragon);
}
})(jQuery);

0 comments on commit 9b372e3

Please sign in to comment.