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