wp/wp-includes/js/comment-reply.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   176 		temporaryElement.parentNode.replaceChild( respondElement, temporaryElement );
   176 		temporaryElement.parentNode.replaceChild( respondElement, temporaryElement );
   177 		cancelLink.style.display = 'none';
   177 		cancelLink.style.display = 'none';
   178 
   178 
   179 		var replyHeadingElement  = getElementById( config.commentReplyTitleId );
   179 		var replyHeadingElement  = getElementById( config.commentReplyTitleId );
   180 		var replyHeadingTextNode = replyHeadingElement && replyHeadingElement.firstChild;
   180 		var replyHeadingTextNode = replyHeadingElement && replyHeadingElement.firstChild;
       
   181 		var replyLinkToParent    = replyHeadingTextNode && replyHeadingTextNode.nextSibling;
   181 
   182 
   182 		if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE && headingText ) {
   183 		if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE && headingText ) {
       
   184 			if ( replyLinkToParent && 'A' === replyLinkToParent.nodeName && replyLinkToParent.id !== config.cancelReplyId ) {
       
   185 				replyLinkToParent.style.display = '';
       
   186 			}
       
   187 
   183 			replyHeadingTextNode.textContent = headingText;
   188 			replyHeadingTextNode.textContent = headingText;
   184 		}
   189 		}
   185 
   190 
   186 		event.preventDefault();
   191 		event.preventDefault();
   187 	}
   192 	}
   195 	 */
   200 	 */
   196 	function clickEvent( event ) {
   201 	function clickEvent( event ) {
   197 		var replyNode = getElementById( config.commentReplyTitleId );
   202 		var replyNode = getElementById( config.commentReplyTitleId );
   198 		var defaultReplyHeading = replyNode && replyNode.firstChild.textContent;
   203 		var defaultReplyHeading = replyNode && replyNode.firstChild.textContent;
   199 		var replyLink = this,
   204 		var replyLink = this,
   200 			commId    = getDataAttribute( replyLink, 'belowelement'),
   205 			commId    = getDataAttribute( replyLink, 'belowelement' ),
   201 			parentId  = getDataAttribute( replyLink, 'commentid' ),
   206 			parentId  = getDataAttribute( replyLink, 'commentid' ),
   202 			respondId = getDataAttribute( replyLink, 'respondelement' ),
   207 			respondId = getDataAttribute( replyLink, 'respondelement' ),
   203 			postId    = getDataAttribute( replyLink, 'postid' ),
   208 			postId    = getDataAttribute( replyLink, 'postid' ),
   204 			replyTo   = getDataAttribute( replyLink, 'replyto' ) || defaultReplyHeading,
   209 			replyTo   = getDataAttribute( replyLink, 'replyto' ) || defaultReplyHeading,
   205 			follow;
   210 			follow;
   317 		var postIdField     = getElementById( config.postIdFieldId );
   322 		var postIdField     = getElementById( config.postIdFieldId );
   318 		var element, cssHidden, style;
   323 		var element, cssHidden, style;
   319 
   324 
   320 		var replyHeading         = getElementById( config.commentReplyTitleId );
   325 		var replyHeading         = getElementById( config.commentReplyTitleId );
   321 		var replyHeadingTextNode = replyHeading && replyHeading.firstChild;
   326 		var replyHeadingTextNode = replyHeading && replyHeading.firstChild;
       
   327 		var replyLinkToParent    = replyHeadingTextNode && replyHeadingTextNode.nextSibling;
   322 
   328 
   323 		if ( ! addBelowElement || ! respondElement || ! parentIdField ) {
   329 		if ( ! addBelowElement || ! respondElement || ! parentIdField ) {
   324 			// Missing key elements, fail.
   330 			// Missing key elements, fail.
   325 			return;
   331 			return;
   326 		}
   332 		}
   340 
   346 
   341 		cancelElement.style.display = '';
   347 		cancelElement.style.display = '';
   342 		addBelowElement.parentNode.insertBefore( respondElement, addBelowElement.nextSibling );
   348 		addBelowElement.parentNode.insertBefore( respondElement, addBelowElement.nextSibling );
   343 
   349 
   344 		if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE ) {
   350 		if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE ) {
       
   351 			if ( replyLinkToParent && 'A' === replyLinkToParent.nodeName && replyLinkToParent.id !== config.cancelReplyId ) {
       
   352 				replyLinkToParent.style.display = 'none';
       
   353 			}
       
   354 
   345 			replyHeadingTextNode.textContent = replyTo;
   355 			replyHeadingTextNode.textContent = replyTo;
   346 		}
   356 		}
   347 
   357 
   348 		/*
   358 		/*
   349 		 * This is for backward compatibility with third party commenting systems
   359 		 * This is for backward compatibility with third party commenting systems