'use strict'; /* global $:off */ /** * @external CommentItem */ var utils = require( './utils.js' ); /** * Add an attribute to a list item to remove pre-whitespace in Parsoid * * @param {HTMLElement} listItem List item element */ function whitespaceParsoidHack( listItem ) { // HACK: Setting data-parsoid removes the whitespace after the list item, // which makes nested lists work. // This is undocumented behaviour and probably very fragile. listItem.setAttribute( 'data-parsoid', '{}' ); } /** * Given a comment and a reply link, add the reply link to its document's DOM tree, at the end of * the comment. * * @param {CommentItem} comment Comment data returned by parser#groupThreads * @param {HTMLElement} linkNode Reply link */ function addReplyLink( comment, linkNode ) { var target = comment.range.endContainer; // Skip to the end of the "paragraph". This only looks at tag names and can be fooled by CSS, but // avoiding that would be more difficult and slower. while ( target.nextSibling && !ve.isBlockElement( target.nextSibling ) ) { target = target.nextSibling; } // Insert the link before trailing whitespace. // In the MediaWiki parser output,