Skip to content

Commit 9515939

Browse files
committed
Fix hCaptcha not loading on Contact Form 7.
1 parent 02af3b9 commit 9515939

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

assets/js/hcaptcha-cf7.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ document.addEventListener( 'DOMContentLoaded', function() {
1111
return form;
1212
} );
1313
} );
14+
15+
document.addEventListener( 'DOMContentLoaded', hCaptchaBindEvents );

src/js/hcaptcha/hcaptcha.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,12 +590,12 @@ class HCaptcha {
590590
this.getForms().map( ( formElement ) => {
591591
const hcaptchaElement = formElement.querySelector( '.h-captcha' );
592592

593-
if ( el && ( el !== hcaptchaElement ) ) {
593+
// Ignore forms not having hcaptcha.
594+
if ( null === hcaptchaElement ) {
594595
return formElement;
595596
}
596597

597-
// Ignore forms not having hcaptcha.
598-
if ( null === hcaptchaElement ) {
598+
if ( ( el instanceof HTMLElement ) && ( el !== hcaptchaElement ) ) {
599599
return formElement;
600600
}
601601

0 commit comments

Comments
 (0)