Comments: Check if reply heading text node exists before accessing its property in comment-reply.js
.
Follow-up to [47506], [48876]. Props johannadevos, mailnew2ster. Merges [48904] to the 5.5 branch. Fixes #38009. git-svn-id: https://develop.svn.wordpress.org/branches/5.5@48917 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
56fef3742a
commit
d5e894c20c
@ -175,11 +175,14 @@ window.addComment = ( function( window ) {
|
||||
var headingText = temporaryElement.textContent;
|
||||
temporaryElement.parentNode.replaceChild( respondElement, temporaryElement );
|
||||
cancelLink.style.display = 'none';
|
||||
var replyHeadingElement = getElementById( config.commentReplyTitleId );
|
||||
|
||||
var replyHeadingElement = getElementById( config.commentReplyTitleId );
|
||||
var replyHeadingTextNode = replyHeadingElement && replyHeadingElement.firstChild;
|
||||
|
||||
if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE && headingText ) {
|
||||
replyHeadingTextNode.textContent = headingText;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
@ -314,7 +317,7 @@ window.addComment = ( function( window ) {
|
||||
var postIdField = getElementById( config.postIdFieldId );
|
||||
var element, cssHidden, style;
|
||||
|
||||
var replyHeading = getElementById( config.commentReplyTitleId );
|
||||
var replyHeading = getElementById( config.commentReplyTitleId );
|
||||
var replyHeadingTextNode = replyHeading && replyHeading.firstChild;
|
||||
|
||||
if ( ! addBelowElement || ! respondElement || ! parentIdField ) {
|
||||
@ -337,9 +340,11 @@ window.addComment = ( function( window ) {
|
||||
|
||||
cancelElement.style.display = '';
|
||||
addBelowElement.parentNode.insertBefore( respondElement, addBelowElement.nextSibling );
|
||||
if ( replyHeadingTextNode.nodeType === Node.TEXT_NODE ) {
|
||||
|
||||
if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE ) {
|
||||
replyHeadingTextNode.textContent = replyTo;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is for backward compatibility with third party commenting systems
|
||||
* hooking into the event using older techniques.
|
||||
|
Loading…
Reference in New Issue
Block a user