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

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

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

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

cancelEvent( event )   X-Ref
Cancel event handler.

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

clickEvent( event )   X-Ref
Click event handler.

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

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.

param: {Array} mutationRecords Array of MutationRecord objects.
since: 5.1.0

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

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

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

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

Local alias for document.getElementById.

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

moveForm( addBelowId, commentId, respondId, postId, replyTo )   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.
param: {string} replyTo    Form heading content.
since: 2.7.0

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



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1