Skip to content

Commit

Permalink
remove jquery dependency from payment page js
Browse files Browse the repository at this point in the history
- to avoid edge-case issue: when merchant use unknown 3rd party asset optimizer plugin, on payment page, jQuery may be loaded late/randomly (race condition). it can cause jQuery is undefined that prevent the payment js to run.
  • Loading branch information
rizdaprasetya committed Sep 1, 2021
1 parent b6cbc30 commit 2822376
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions public/js/midtrans-payment-page-main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// wc_midtrans var is passed from payment-page backend via inline script.

;(function( $, window, document ) {
;(function( window, document ) {
var payButton = document.getElementById("pay-button");

/**
Expand Down Expand Up @@ -242,5 +242,4 @@

handlePayAction();
payButton.innerHTML = "Proceed To Payment";
})( jQuery, window, document );
// well jQuery is not actually used, just for formality
})( window, document );

0 comments on commit 2822376

Please sign in to comment.