[ Index ]

WordPress 5.4.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    




/wp-includes/js/ -> comment-reply.js (summary)

Handles the addition of the comment form.

File Size: 406 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 11 functions


Functions that are not part of a class:

ready()   X-Ref
Sets up object variables after the DOM is ready.

init( context )   X-Ref
Add events to links classed .comment-reply-link.

Searches the context for reply links and adds the JavaScript events
required to move the comment form. To allow for lazy loading of
comments this method is exposed as window.commentReply.init().

param: {HTMLElement} context The parent DOM element to search for links.

replyLinks( context )   X-Ref
Return all links classed .comment-reply-link.

param: {HTMLElement} context The parent DOM element to search for links.
return: {HTMLCollection|NodeList|Array}

cancelEvent( event )   X-Ref
Cancel event handler.

param: {Event} event The calling event.

clickEvent( event )   X-Ref
Click event handler.

param: {Event} event The calling event.

observeChanges()   X-Ref
Creates a mutation observer to check for newly inserted comments.

handleChanges( mutationRecords )   X-Ref
Handles DOM changes, calling init() if any new nodes are added.

param: {Array} mutationRecords Array of MutationRecord objects.

getDataAttribute( element, attribute )   X-Ref
Backward compatible getter of data-* attribute.

Uses element.dataset if it exists, otherwise uses getAttribute.

param: {HTMLElement} Element DOM element with the attribute.
param: {String}      Attribute the attribute to get.
return: {String}

getElementById( elementId )   X-Ref
Get element by ID.

Local alias for document.getElementById.

param: {HTMLElement} The requested element.

moveForm( addBelowId, commentId, respondId, postId )   X-Ref
Moves the reply form from its current position to the reply location.

param: {String} addBelowId HTML ID of element the form follows.
param: {String} commentId  Database ID of comment being replied to.
param: {String} respondId  HTML ID of 'respond' element.
param: {String} postId     Database ID of the post.

addPlaceHolder( respondElement )   X-Ref
Add placeholder element.

Places a place holder element above the #respond element for
the form to be returned to if needs be.

param: {HTMLelement} respondElement the #respond element holding comment form.

Generated: Tue May 19 15:51:04 2020 Cross-referenced by PHPXref 0.7.1