[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

Handles the addition of the comment form.

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

Defines 11 functions

  ready()
  init()
  replyLinks()
  cancelEvent()
  clickEvent()
  observeChanges()
  handleChanges()
  getDataAttribute()
  getElementById()
  moveForm()
  addPlaceHolder()

Functions
Functions that are not part of a class:

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

since: 5.1.1

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().

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

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

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

cancelEvent( event )   X-Ref
Cancel event handler.

since: 5.1.0
param: {Event} event The calling event.

clickEvent( event )   X-Ref
Click event handler.

since: 5.1.0
param: {Event} event The calling event.

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

since: 5.1.0

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

since: 5.1.0
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.

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

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

Local alias for document.getElementById.

since: 5.1.0
param: {HTMLElement} The requested element.

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

since: 2.7.0
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.
param: {string} replyTo    Form heading content.

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.

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



Generated: Tue Apr 16 01:00:02 2024 Cross-referenced by PHPXref 0.7.1