2020-03-08 14:32:38 +00:00
|
|
|
'use strict';
|
2020-05-22 16:26:05 +00:00
|
|
|
/* global $:off */
|
2020-03-08 14:32:38 +00:00
|
|
|
|
2021-06-24 16:21:31 +00:00
|
|
|
/**
|
|
|
|
* @constant
|
|
|
|
*/
|
|
|
|
var NEW_TOPIC_COMMENT_ID = 'new|' + mw.config.get( 'wgRelevantPageName' );
|
|
|
|
|
2020-12-05 21:15:11 +00:00
|
|
|
/**
|
|
|
|
* @param {Node} node
|
|
|
|
* @return {boolean} Node is a block element
|
|
|
|
*/
|
|
|
|
function isBlockElement( node ) {
|
|
|
|
return node instanceof HTMLElement && ve.isBlockElement( node );
|
|
|
|
}
|
|
|
|
|
2021-04-08 13:46:09 +00:00
|
|
|
var solTransparentLinkRegexp = /(?:^|\s)mw:PageProp\/(?:Category|redirect|Language)(?=$|\s)/;
|
2021-01-26 03:36:27 +00:00
|
|
|
|
2020-12-05 21:49:23 +00:00
|
|
|
/**
|
|
|
|
* @param {Node} node
|
|
|
|
* @return {boolean} Node is considered a rendering-transparent node in Parsoid
|
|
|
|
*/
|
|
|
|
function isRenderingTransparentNode( node ) {
|
|
|
|
return (
|
|
|
|
node.nodeType === Node.COMMENT_NODE ||
|
|
|
|
node.nodeType === Node.ELEMENT_NODE && (
|
|
|
|
node.tagName.toLowerCase() === 'meta' ||
|
2021-01-26 03:36:27 +00:00
|
|
|
(
|
|
|
|
node.tagName.toLowerCase() === 'link' &&
|
|
|
|
solTransparentLinkRegexp.test( node.getAttribute( 'rel' ) || '' )
|
|
|
|
) ||
|
2020-12-09 11:58:58 +00:00
|
|
|
// Empty inline templates, e.g. tracking templates
|
|
|
|
(
|
|
|
|
node.tagName.toLowerCase() === 'span' &&
|
2021-01-14 21:11:32 +00:00
|
|
|
( node.getAttribute( 'typeof' ) || '' ).split( ' ' ).indexOf( 'mw:Transclusion' ) !== -1 &&
|
2020-12-09 11:58:58 +00:00
|
|
|
// eslint-disable-next-line no-use-before-define
|
|
|
|
!htmlTrim( node.innerHTML )
|
|
|
|
)
|
2020-12-05 21:49:23 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-14 20:13:55 +00:00
|
|
|
// Elements which can't have element children (but some may have text content).
|
|
|
|
// https://html.spec.whatwg.org/#elements-2
|
2021-04-08 13:46:09 +00:00
|
|
|
var noElementChildrenElementTypes = [
|
2020-12-14 20:13:55 +00:00
|
|
|
// Void elements
|
|
|
|
'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',
|
|
|
|
'link', 'meta', 'param', 'source', 'track', 'wbr',
|
|
|
|
// Raw text elements
|
|
|
|
'script', 'style',
|
|
|
|
// Escapable raw text elements
|
2021-03-04 19:26:20 +00:00
|
|
|
'textarea', 'title',
|
|
|
|
// Treated like text when scripting is enabled in the parser
|
|
|
|
// https://html.spec.whatwg.org/#the-noscript-element
|
|
|
|
'noscript'
|
2020-12-14 20:13:55 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {Node} node
|
|
|
|
* @return {boolean} If true, node can't have element children. If false, it's complicated.
|
|
|
|
*/
|
|
|
|
function cantHaveElementChildren( node ) {
|
|
|
|
return (
|
|
|
|
node.nodeType === Node.COMMENT_NODE ||
|
|
|
|
node.nodeType === Node.ELEMENT_NODE &&
|
|
|
|
noElementChildrenElementTypes.indexOf( node.tagName.toLowerCase() ) !== -1
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-05-22 17:09:21 +00:00
|
|
|
/**
|
|
|
|
* Get the index of a node in its parentNode's childNode list
|
|
|
|
*
|
|
|
|
* @param {Node} child
|
|
|
|
* @return {number} Index in parentNode's childNode list
|
|
|
|
*/
|
|
|
|
function childIndexOf( child ) {
|
|
|
|
var i = 0;
|
|
|
|
while ( ( child = child.previousSibling ) ) {
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2020-08-10 19:37:42 +00:00
|
|
|
/**
|
|
|
|
* Check whether a Node contains (is an ancestor of) another Node (or is the same node)
|
|
|
|
*
|
|
|
|
* @param {Node} ancestor
|
|
|
|
* @param {Node} descendant
|
|
|
|
* @return {boolean}
|
|
|
|
*/
|
|
|
|
function contains( ancestor, descendant ) {
|
|
|
|
// Support: IE 11
|
|
|
|
// Node#contains is only supported on HTMLElement nodes. Otherwise we could just use
|
|
|
|
// `ancestor.contains( descendant )`.
|
|
|
|
return ancestor === descendant ||
|
|
|
|
// eslint-disable-next-line no-bitwise
|
|
|
|
ancestor.compareDocumentPosition( descendant ) & Node.DOCUMENT_POSITION_CONTAINED_BY;
|
|
|
|
}
|
|
|
|
|
2020-03-08 14:32:38 +00:00
|
|
|
/**
|
|
|
|
* Find closest ancestor element using one of the given tag names.
|
|
|
|
*
|
2020-05-11 20:07:14 +00:00
|
|
|
* @param {Node} node
|
2020-03-08 14:32:38 +00:00
|
|
|
* @param {string[]} tagNames
|
|
|
|
* @return {HTMLElement|null}
|
|
|
|
*/
|
2020-05-11 20:07:14 +00:00
|
|
|
function closestElement( node, tagNames ) {
|
2020-03-08 14:32:38 +00:00
|
|
|
do {
|
2020-05-11 20:07:14 +00:00
|
|
|
if (
|
|
|
|
node.nodeType === Node.ELEMENT_NODE &&
|
|
|
|
tagNames.indexOf( node.tagName.toLowerCase() ) !== -1
|
|
|
|
) {
|
|
|
|
return node;
|
2020-03-08 14:32:38 +00:00
|
|
|
}
|
2020-05-11 20:07:14 +00:00
|
|
|
node = node.parentNode;
|
|
|
|
} while ( node );
|
2020-03-08 14:32:38 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-05-31 15:17:59 +00:00
|
|
|
/**
|
|
|
|
* Find the transclusion node which rendered the current node, if it exists.
|
|
|
|
*
|
|
|
|
* 1. Find the closest ancestor with an 'about' attribute
|
|
|
|
* 2. Find the main node of the about-group (first sibling with the same 'about' attribute)
|
|
|
|
* 3. If this is an mw:Transclusion node, return it; otherwise, go to step 1
|
|
|
|
*
|
|
|
|
* @param {Node} node
|
|
|
|
* @return {HTMLElement|null} Translcusion node, null if not found
|
|
|
|
*/
|
|
|
|
function getTranscludedFromElement( node ) {
|
|
|
|
while ( node ) {
|
|
|
|
// 1.
|
|
|
|
if (
|
|
|
|
node.nodeType === Node.ELEMENT_NODE &&
|
|
|
|
node.getAttribute( 'about' ) &&
|
|
|
|
/^#mwt\d+$/.test( node.getAttribute( 'about' ) )
|
|
|
|
) {
|
2021-04-08 13:46:09 +00:00
|
|
|
var about = node.getAttribute( 'about' );
|
2020-05-31 15:17:59 +00:00
|
|
|
|
|
|
|
// 2.
|
|
|
|
while (
|
|
|
|
node.previousSibling &&
|
|
|
|
node.previousSibling.nodeType === Node.ELEMENT_NODE &&
|
|
|
|
node.previousSibling.getAttribute( 'about' ) === about
|
|
|
|
) {
|
|
|
|
node = node.previousSibling;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 3.
|
|
|
|
if (
|
|
|
|
node.getAttribute( 'typeof' ) &&
|
|
|
|
node.getAttribute( 'typeof' ).split( ' ' ).indexOf( 'mw:Transclusion' ) !== -1
|
|
|
|
) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
node = node.parentNode;
|
|
|
|
}
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2020-11-04 21:36:53 +00:00
|
|
|
/**
|
|
|
|
* Given a heading node, return the node on which the ID attribute is set.
|
|
|
|
*
|
|
|
|
* Also returns the offset within that node where the heading text starts.
|
|
|
|
*
|
|
|
|
* @param {HTMLElement} heading Heading node (`<h1>`-`<h6>`)
|
|
|
|
* @return {Array} Array containing a 'node' (HTMLElement) and offset (number)
|
|
|
|
*/
|
|
|
|
function getHeadlineNodeAndOffset( heading ) {
|
|
|
|
// This code assumes that $wgFragmentMode is [ 'html5', 'legacy' ] or [ 'html5' ]
|
|
|
|
var headline = heading,
|
|
|
|
offset = 0;
|
|
|
|
|
2021-03-10 17:25:52 +00:00
|
|
|
if ( headline.hasAttribute( 'data-mw-comment-start' ) ) {
|
2020-11-04 21:36:53 +00:00
|
|
|
headline = headline.parentNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !headline.getAttribute( 'id' ) ) {
|
|
|
|
// PHP HTML: Find the child with .mw-headline
|
|
|
|
headline = headline.querySelector( '.mw-headline' );
|
|
|
|
if ( headline ) {
|
|
|
|
if ( headline.querySelector( '.mw-headline-number' ) ) {
|
|
|
|
offset = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
headline = heading;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
node: headline,
|
|
|
|
offset: offset
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-05-11 20:07:14 +00:00
|
|
|
/**
|
|
|
|
* Trim ASCII whitespace, as defined in the HTML spec.
|
|
|
|
*
|
|
|
|
* @param {string} str
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
function htmlTrim( str ) {
|
|
|
|
// https://infra.spec.whatwg.org/#ascii-whitespace
|
|
|
|
return str.replace( /^[\t\n\f\r ]+/, '' ).replace( /[\t\n\f\r ]+$/, '' );
|
|
|
|
}
|
|
|
|
|
2020-07-29 23:57:51 +00:00
|
|
|
/**
|
|
|
|
* Get the indent level of the node, relative to rootNode.
|
|
|
|
*
|
|
|
|
* The indent level is the number of lists inside of which it is nested.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @param {Node} node
|
|
|
|
* @param {Node} rootNode
|
|
|
|
* @return {number}
|
|
|
|
*/
|
|
|
|
function getIndentLevel( node, rootNode ) {
|
2021-04-08 13:46:09 +00:00
|
|
|
var indent = 0;
|
2020-07-29 23:57:51 +00:00
|
|
|
while ( node ) {
|
|
|
|
if ( node === rootNode ) {
|
|
|
|
break;
|
|
|
|
}
|
2021-04-08 13:46:09 +00:00
|
|
|
var tagName = node.tagName && node.tagName.toLowerCase();
|
2020-07-29 23:57:51 +00:00
|
|
|
if ( tagName === 'li' || tagName === 'dd' ) {
|
|
|
|
indent++;
|
|
|
|
}
|
|
|
|
node = node.parentNode;
|
|
|
|
}
|
|
|
|
return indent;
|
|
|
|
}
|
|
|
|
|
2020-05-27 17:31:31 +00:00
|
|
|
/**
|
2021-01-26 18:58:58 +00:00
|
|
|
* Get an array of sibling nodes that contain parts of the given range.
|
2020-05-27 17:31:31 +00:00
|
|
|
*
|
2021-01-26 18:58:58 +00:00
|
|
|
* @param {Range} range
|
2020-06-16 14:08:01 +00:00
|
|
|
* @return {HTMLElement[]}
|
|
|
|
*/
|
2021-01-26 18:58:58 +00:00
|
|
|
function getCoveredSiblings( range ) {
|
2021-04-08 13:46:09 +00:00
|
|
|
var ancestor = range.commonAncestorContainer;
|
2020-06-16 14:08:01 +00:00
|
|
|
|
2021-04-08 13:46:09 +00:00
|
|
|
var siblings = ancestor.childNodes;
|
|
|
|
var start = 0;
|
|
|
|
var end = siblings.length - 1;
|
2020-06-16 14:08:01 +00:00
|
|
|
|
|
|
|
// Find first of the siblings that contains the item
|
2021-02-02 23:08:54 +00:00
|
|
|
if ( ancestor === range.startContainer ) {
|
|
|
|
start = range.startOffset;
|
|
|
|
} else {
|
|
|
|
while ( !contains( siblings[ start ], range.startContainer ) ) {
|
|
|
|
start++;
|
|
|
|
}
|
2020-06-16 14:08:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Find last of the siblings that contains the item
|
2021-02-02 23:08:54 +00:00
|
|
|
if ( ancestor === range.endContainer ) {
|
|
|
|
end = range.endOffset - 1;
|
|
|
|
} else {
|
|
|
|
while ( !contains( siblings[ end ], range.endContainer ) ) {
|
|
|
|
end--;
|
|
|
|
}
|
2020-06-16 14:08:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Array.prototype.slice.call( siblings, start, end + 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the nodes (if any) that contain the given thread item, and nothing else.
|
|
|
|
*
|
|
|
|
* @param {ThreadItem} item Thread item
|
|
|
|
* @return {HTMLElement[]|null}
|
2020-05-27 17:31:31 +00:00
|
|
|
*/
|
2020-06-16 14:08:01 +00:00
|
|
|
function getFullyCoveredSiblings( item ) {
|
2021-04-08 13:46:09 +00:00
|
|
|
var siblings = getCoveredSiblings( item.getNativeRange() );
|
|
|
|
var startContainer = item.range.startContainer;
|
|
|
|
var endContainer = item.range.endContainer;
|
|
|
|
var startOffset = item.range.startOffset;
|
|
|
|
var endOffset = item.range.endOffset;
|
2020-05-27 17:31:31 +00:00
|
|
|
|
2020-08-26 22:46:34 +00:00
|
|
|
function isIgnored( n ) {
|
2020-05-27 17:31:31 +00:00
|
|
|
// Ignore empty text nodes, and our own reply buttons
|
2020-08-26 22:46:34 +00:00
|
|
|
return ( n.nodeType === Node.TEXT_NODE && htmlTrim( n.textContent ) === '' ) ||
|
2021-03-13 14:41:56 +00:00
|
|
|
( n.className && n.className.indexOf( 'ext-discussiontools-init-replylink-buttons' ) !== -1 );
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
|
|
|
|
2020-12-08 22:46:11 +00:00
|
|
|
function isFirstNonemptyChild( n ) {
|
|
|
|
while ( ( n = n.previousSibling ) ) {
|
|
|
|
if ( !isIgnored( n ) ) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
2020-12-08 22:46:11 +00:00
|
|
|
return true;
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
|
|
|
|
2020-12-08 22:46:11 +00:00
|
|
|
function isLastNonemptyChild( n ) {
|
|
|
|
while ( ( n = n.nextSibling ) ) {
|
|
|
|
if ( !isIgnored( n ) ) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
2020-12-08 22:46:11 +00:00
|
|
|
return true;
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
|
|
|
|
2021-04-08 13:46:09 +00:00
|
|
|
var startMatches = false;
|
|
|
|
var node = siblings[ 0 ];
|
2020-05-27 17:31:31 +00:00
|
|
|
while ( node ) {
|
2021-02-02 23:08:54 +00:00
|
|
|
if ( startContainer.childNodes && startContainer.childNodes[ startOffset ] === node ) {
|
|
|
|
startMatches = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( startContainer === node && startOffset === 0 ) {
|
2020-05-27 17:31:31 +00:00
|
|
|
startMatches = true;
|
|
|
|
break;
|
|
|
|
}
|
2020-12-08 22:46:11 +00:00
|
|
|
if ( isIgnored( node ) ) {
|
|
|
|
node = node.nextSibling;
|
|
|
|
} else {
|
|
|
|
node = node.firstChild;
|
|
|
|
}
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
|
|
|
|
2021-04-08 13:46:09 +00:00
|
|
|
var endMatches = false;
|
2020-06-16 14:08:01 +00:00
|
|
|
node = siblings[ siblings.length - 1 ];
|
2020-05-27 17:31:31 +00:00
|
|
|
while ( node ) {
|
2021-02-02 23:08:54 +00:00
|
|
|
if ( endContainer.childNodes && endContainer.childNodes[ endOffset - 1 ] === node ) {
|
|
|
|
endMatches = true;
|
|
|
|
break;
|
|
|
|
}
|
2021-04-08 13:46:09 +00:00
|
|
|
var length = node.nodeType === Node.TEXT_NODE ?
|
2020-05-27 17:31:31 +00:00
|
|
|
node.textContent.replace( /[\t\n\f\r ]+$/, '' ).length :
|
|
|
|
node.childNodes.length;
|
2021-02-02 23:08:54 +00:00
|
|
|
if ( endContainer === node && endOffset === length ) {
|
2020-05-27 17:31:31 +00:00
|
|
|
endMatches = true;
|
|
|
|
break;
|
|
|
|
}
|
2020-12-08 22:46:11 +00:00
|
|
|
if ( isIgnored( node ) ) {
|
|
|
|
node = node.previousSibling;
|
|
|
|
} else {
|
|
|
|
node = node.lastChild;
|
|
|
|
}
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( startMatches && endMatches ) {
|
2021-04-08 13:46:09 +00:00
|
|
|
var parent;
|
2020-06-16 14:08:01 +00:00
|
|
|
// If these are all of the children (or the only child), go up one more level
|
2020-05-27 17:31:31 +00:00
|
|
|
while (
|
2020-06-16 14:08:01 +00:00
|
|
|
( parent = siblings[ 0 ].parentNode ) &&
|
2020-12-08 22:46:11 +00:00
|
|
|
isFirstNonemptyChild( siblings[ 0 ] ) &&
|
|
|
|
isLastNonemptyChild( siblings[ siblings.length - 1 ] )
|
2020-05-27 17:31:31 +00:00
|
|
|
) {
|
2020-06-16 14:08:01 +00:00
|
|
|
siblings = [ parent ];
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
2020-06-16 14:08:01 +00:00
|
|
|
return siblings;
|
2020-05-27 17:31:31 +00:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-06-24 19:10:40 +00:00
|
|
|
/**
|
|
|
|
* Get a MediaWiki page title from a URL.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @param {string} url
|
|
|
|
* @return {mw.Title|null} Page title, or null if this isn't a link to a page
|
|
|
|
*/
|
|
|
|
function getTitleFromUrl( url ) {
|
|
|
|
try {
|
|
|
|
url = new mw.Uri( url );
|
|
|
|
} catch ( err ) {
|
|
|
|
// T106244: URL encoded values using fallback 8-bit encoding (invalid UTF-8) cause mediawiki.Uri to crash
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if ( url.query.title ) {
|
|
|
|
return mw.Title.newFromText( url.query.title );
|
|
|
|
}
|
|
|
|
|
|
|
|
var articlePathRegexp = new RegExp(
|
|
|
|
mw.util.escapeRegExp( mw.config.get( 'wgArticlePath' ) )
|
|
|
|
.replace( mw.util.escapeRegExp( '$1' ), '(.*)' )
|
|
|
|
);
|
|
|
|
var match;
|
|
|
|
if ( ( match = url.path.match( articlePathRegexp ) ) ) {
|
|
|
|
return mw.Title.newFromText( decodeURIComponent( match[ 1 ] ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-01-08 19:20:33 +00:00
|
|
|
/**
|
|
|
|
* Traverse the document in depth-first order, calling the callback whenever entering and leaving
|
|
|
|
* a node. The walk starts before the given node and ends when callback returns a truthy value, or
|
|
|
|
* after reaching the end of the document.
|
|
|
|
*
|
|
|
|
* You might also think about this as processing XML token stream linearly (rather than XML
|
|
|
|
* nodes), as if we were parsing the document.
|
|
|
|
*
|
|
|
|
* @param {Node} node Node to start at
|
|
|
|
* @param {Function} callback Function accepting two arguments: `event` ('enter' or 'leave') and
|
|
|
|
* `node` (DOMNode)
|
|
|
|
* @return {Mixed} Final return value of the callback
|
|
|
|
*/
|
|
|
|
function linearWalk( node, callback ) {
|
|
|
|
var
|
|
|
|
result = null,
|
|
|
|
withinNode = node.parentNode,
|
|
|
|
beforeNode = node;
|
|
|
|
|
|
|
|
while ( beforeNode || withinNode ) {
|
|
|
|
if ( beforeNode ) {
|
|
|
|
result = callback( 'enter', beforeNode );
|
|
|
|
withinNode = beforeNode;
|
|
|
|
beforeNode = beforeNode.firstChild;
|
|
|
|
} else {
|
|
|
|
result = callback( 'leave', withinNode );
|
|
|
|
beforeNode = withinNode.nextSibling;
|
|
|
|
withinNode = withinNode.parentNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( result ) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-01-26 18:58:58 +00:00
|
|
|
/**
|
|
|
|
* Like #linearWalk, but it goes backwards.
|
|
|
|
*
|
|
|
|
* @inheritdoc #linearWalk
|
|
|
|
*/
|
|
|
|
function linearWalkBackwards( node, callback ) {
|
|
|
|
var
|
|
|
|
result = null,
|
|
|
|
withinNode = node.parentNode,
|
|
|
|
beforeNode = node;
|
|
|
|
|
|
|
|
while ( beforeNode || withinNode ) {
|
|
|
|
if ( beforeNode ) {
|
|
|
|
result = callback( 'enter', beforeNode );
|
|
|
|
withinNode = beforeNode;
|
|
|
|
beforeNode = beforeNode.lastChild;
|
|
|
|
} else {
|
|
|
|
result = callback( 'leave', withinNode );
|
|
|
|
beforeNode = withinNode.previousSibling;
|
|
|
|
withinNode = withinNode.parentNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( result ) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-03-08 14:32:38 +00:00
|
|
|
module.exports = {
|
2021-06-24 16:21:31 +00:00
|
|
|
NEW_TOPIC_COMMENT_ID: NEW_TOPIC_COMMENT_ID,
|
2020-12-05 21:15:11 +00:00
|
|
|
isBlockElement: isBlockElement,
|
2020-12-05 21:49:23 +00:00
|
|
|
isRenderingTransparentNode: isRenderingTransparentNode,
|
2020-12-14 20:13:55 +00:00
|
|
|
cantHaveElementChildren: cantHaveElementChildren,
|
2020-05-22 17:09:21 +00:00
|
|
|
childIndexOf: childIndexOf,
|
2020-05-11 20:07:14 +00:00
|
|
|
closestElement: closestElement,
|
2020-07-29 23:57:51 +00:00
|
|
|
getIndentLevel: getIndentLevel,
|
2021-01-26 18:58:58 +00:00
|
|
|
getCoveredSiblings: getCoveredSiblings,
|
2020-06-16 14:08:01 +00:00
|
|
|
getFullyCoveredSiblings: getFullyCoveredSiblings,
|
2020-05-31 15:17:59 +00:00
|
|
|
getTranscludedFromElement: getTranscludedFromElement,
|
2020-11-04 21:36:53 +00:00
|
|
|
getHeadlineNodeAndOffset: getHeadlineNodeAndOffset,
|
2021-01-08 19:20:33 +00:00
|
|
|
htmlTrim: htmlTrim,
|
2021-06-24 19:10:40 +00:00
|
|
|
getTitleFromUrl: getTitleFromUrl,
|
2021-01-26 18:58:58 +00:00
|
|
|
linearWalk: linearWalk,
|
|
|
|
linearWalkBackwards: linearWalkBackwards
|
2020-03-08 14:32:38 +00:00
|
|
|
};
|