mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-30 19:16:39 +00:00
6e37a172ae
As a result of 0fc71f60cd
, "empty" text
nodes (containing only whitespace) at the end of the comment may be
inside the comment's range, and trying to ignore them caused the
ranges not to match and the frame not to be detected.
Now the code works whether they're inside the comment's range or not.
Add a test case for wrapped discussion comments with HTML comments and
with whitespace.
Bug: T250126
Bug: T268407
Change-Id: I2217ff5a635fd1c9c9e803f46795b1bfb3d17535
36 lines
12 KiB
HTML
36 lines
12 KiB
HTML
<h2 id="paragraph" data-mw-comment='{"type":"heading","level":0,"id":"h|paragraph|2020-01-22T23:19:00.000Z","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|paragraph"],"headingLevel":2,"placeholderHeading":false}'><span data-mw-comment-start="h|paragraph|2020-01-22T23:19:00.000Z"></span>paragraph<span data-mw-comment-end="h|paragraph|2020-01-22T23:19:00.000Z"></span></h2>
|
|
<p><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|paragraph"></span>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|paragraph","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|paragraph"></span></p>
|
|
|
|
<h2 id="preformatted" data-mw-comment='{"type":"heading","level":0,"id":"h|preformatted|2020-01-22T23:19:00.000Z","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|preformatted"],"headingLevel":2,"placeholderHeading":false}'><span data-mw-comment-start="h|preformatted|2020-01-22T23:19:00.000Z"></span>preformatted<span data-mw-comment-end="h|preformatted|2020-01-22T23:19:00.000Z"></span></h2>
|
|
<pre><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|preformatted"></span>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|preformatted","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|preformatted"></span></pre>
|
|
|
|
<h2 id="div_with_one_comment" data-mw-comment='{"type":"heading","level":0,"id":"h|div_with_one_comment|2020-01-22T23:19:00.000Z","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_one_comment"],"headingLevel":2,"placeholderHeading":false}'><span data-mw-comment-start="h|div_with_one_comment|2020-01-22T23:19:00.000Z"></span>div with one comment<span data-mw-comment-end="h|div_with_one_comment|2020-01-22T23:19:00.000Z"></span></h2>
|
|
<div style="background: beige;"><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_one_comment"></span>
|
|
blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_one_comment","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_one_comment"></span>
|
|
</div>
|
|
|
|
<h2 id="div_with_one_comment-htmlcomments" data-mw-comment='{"type":"heading","level":0,"id":"h|div_with_one_comment-htmlcomments|2020-01-22T23:19:00.000Z","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_one_comment-htmlcomments"],"headingLevel":2,"placeholderHeading":false}'><span data-mw-comment-start="h|div_with_one_comment-htmlcomments|2020-01-22T23:19:00.000Z"></span>div with one comment, and some HTML comments<span data-mw-comment-end="h|div_with_one_comment-htmlcomments|2020-01-22T23:19:00.000Z"></span></h2>
|
|
<div style="background: beige;">
|
|
<i><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_one_comment-htmlcomments"></span>hello</i><br/>
|
|
<small>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)</small><!-- blah --><span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_one_comment-htmlcomments","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_one_comment-htmlcomments"></span>
|
|
</div><!-- blah -->
|
|
|
|
<h2 id="table_with_one_comment" data-mw-comment='{"type":"heading","level":0,"id":"h|table_with_one_comment|2020-01-22T23:19:00.000Z","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_one_comment"],"headingLevel":2,"placeholderHeading":false}'><span data-mw-comment-start="h|table_with_one_comment|2020-01-22T23:19:00.000Z"></span>table with one comment<span data-mw-comment-end="h|table_with_one_comment|2020-01-22T23:19:00.000Z"></span></h2>
|
|
<table border="1"><tbody><tr><td><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_one_comment"></span>
|
|
blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_one_comment","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_one_comment"></span>
|
|
</td></tr></tbody></table>
|
|
|
|
<h2 id="div_with_multiple_comments" data-mw-comment='{"type":"heading","level":0,"id":"h|div_with_multiple_comments|2020-01-22T23:19:00.000Z","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_multiple_comments","c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_multiple_comments|1"],"headingLevel":2,"placeholderHeading":false}'><span data-mw-comment-start="h|div_with_multiple_comments|2020-01-22T23:19:00.000Z"></span>div with multiple comments<span data-mw-comment-end="h|div_with_multiple_comments|2020-01-22T23:19:00.000Z"></span></h2>
|
|
<div style="background: beige;"><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_multiple_comments"></span>
|
|
blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_multiple_comments|1"></span><span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_multiple_comments","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|Matma Rex|2020-01-22T23:19:00.000Z"],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_multiple_comments"></span>
|
|
<dl><dd><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|Matma Rex|2020-01-22T23:19:00.000Z"></span>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":2,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|Matma Rex|2020-01-22T23:19:00.000Z","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|Matma Rex|2020-01-22T23:19:00.000Z"></span></dd></dl>
|
|
blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_multiple_comments|1","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|div_with_multiple_comments|1"></span>
|
|
</div>
|
|
|
|
<h2 id="table_with_multiple_comments" data-mw-comment='{"type":"heading","level":0,"id":"h|table_with_multiple_comments|2020-01-22T23:19:00.000Z","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_multiple_comments","c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_multiple_comments|1"],"headingLevel":2,"placeholderHeading":false}'><span data-mw-comment-start="h|table_with_multiple_comments|2020-01-22T23:19:00.000Z"></span>table with multiple comments<span data-mw-comment-end="h|table_with_multiple_comments|2020-01-22T23:19:00.000Z"></span></h2>
|
|
<table border="1"><tbody><tr><td><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_multiple_comments"></span>
|
|
blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_multiple_comments|1"></span><span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_multiple_comments","replies":["c|Matma Rex|2020-01-22T23:19:00.000Z|Matma Rex|2020-01-22T23:19:00.000Z|1"],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_multiple_comments"></span>
|
|
<dl><dd><span data-mw-comment-start="c|Matma Rex|2020-01-22T23:19:00.000Z|Matma Rex|2020-01-22T23:19:00.000Z|1"></span>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":2,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|Matma Rex|2020-01-22T23:19:00.000Z|1","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|Matma Rex|2020-01-22T23:19:00.000Z|1"></span></dd></dl>
|
|
blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<span class="dt-init-replylink-buttons"><span class="dt-init-replylink-bracket">[</span><a class="dt-init-replylink-reply" role="button" tabindex="0" data-mw-comment='{"type":"comment","level":1,"id":"c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_multiple_comments|1","replies":[],"timestamp":"2020-01-22T23:19:00.000Z","author":"Matma Rex"}'>reply</a><span class="dt-init-replylink-bracket">]</span></span><span data-mw-comment-end="c|Matma Rex|2020-01-22T23:19:00.000Z|table_with_multiple_comments|1"></span>
|
|
</td></tr></tbody></table>
|