Open njuaplusplus opened 8 years ago
It is a bit like the issue #53 However it's not fixed completely by issue #54
Maybe we call the Case 3:
<ul>
<li>
Comment 1
</li>
</ul>
<ul>
<li>
Comment 2
</li>
</ul>
</li><!-- This one -->
<ul>
<li>
Comment 3
</li>
</ul>
Because when processing the comment 3 in the forloop,
its parent_id is same as comment 2 (None),
and it will emit a </li>
Here are the codes in your instrcution:
The 2nd line may have some faults. If the
comment.parent_id
remainsNone
, theifchanged
condition isFalse
, and it will output an</li>
. But if the comment is the root comment, that is, the comment is not a reply to an existing comment, its parent_id isNone
. Hence, there may be unnecessary</li>
between the root comments. As the browser is smart enough, it will removed the unmatched</li>
, so we may not be aware of this kind of bug.However, if we use
<div><div>
instead of<ul><li>
, then the unnecessary</div>
will mismatch other<div>
.So, I think the solution is to double check the
comment.parent_id
: