/* global $:off */ 'use strict'; var utils = require( './utils.js' ); 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 {Object} 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,