diff --git a/src/js/_enqueues/lib/comment-reply.js b/src/js/_enqueues/lib/comment-reply.js
index fae92ee237..28d190d86a 100644
a
|
b
|
window.addComment = ( function( window ) { |
32 | 32 | * Check browser supports dataset. |
33 | 33 | * !! sets the variable to true if the property exists. |
34 | 34 | */ |
35 | | var supportsDataset = !! document.body.dataset; |
| 35 | var supportsDataset = !! document.documentElement.dataset; |
36 | 36 | |
37 | 37 | // For holding the cancel element. |
38 | 38 | var cancelElement; |
… |
… |
window.addComment = ( function( window ) { |
46 | 46 | // The mutation observer. |
47 | 47 | var observer; |
48 | 48 | |
49 | | // Initialise the events. |
50 | | init(); |
| 49 | if ( document.readyState !== 'loading' ) { |
| 50 | ready(); |
| 51 | } else if ( cutsTheMustard ) { |
| 52 | window.addEventListener( 'DOMContentLoaded', ready, false ); |
| 53 | } |
51 | 54 | |
52 | | // Set up a MutationObserver to check for comments loaded late. |
53 | | observeChanges(); |
| 55 | /** |
| 56 | * Sets up object variables after the DOM is ready. |
| 57 | * |
| 58 | * @since 5.1.0 |
| 59 | */ |
| 60 | function ready() { |
| 61 | // Initialise the events. |
| 62 | init(); |
| 63 | |
| 64 | // Set up a MutationObserver to check for comments loaded late. |
| 65 | observeChanges(); |
| 66 | } |
54 | 67 | |
55 | 68 | /** |
56 | 69 | * Add events to links classed .comment-reply-link. |
… |
… |
window.addComment = ( function( window ) { |
163 | 176 | postId = getDataAttribute( replyLink, 'postid'), |
164 | 177 | follow; |
165 | 178 | |
| 179 | |
| 180 | if ( ! commId || ! parentId || ! respondId || ! postId ) { |
| 181 | /* |
| 182 | * Theme or plugin defines own link via custom `wp_list_comments()` callback |
| 183 | * and calls `moveForm()` either directly or via a custom event hook. |
| 184 | */ |
| 185 | return; |
| 186 | } |
| 187 | |
166 | 188 | /* |
167 | 189 | * Third party comments systems can hook into this function via the global scope, |
168 | 190 | * therefore the click event needs to reference the global scope. |