Page MenuHomePhabricator

Unnecessary empty <small> tags inserted when it is on the same line with <div>
Closed, InvalidPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

<div><small>
2
</small>
</div>
<div>
<small>
2
</small></div>

What happens?:
It will return respectively

<div><small>
</small><p><small>2
</small>
</p>
</div>
<div>
<p><small>
2
</small></p><small>
</small></div>

Note that there is a <small> tag that only contains the newline character.

However, these the two examples

<div>
<small>
2
</small>
</div>
<div><small>
2
</small></div>

return respectively

<div>
<p><small>
2
</small>
</p>
</div>
<div><small>
<p>2
</p>
</small></div>

free of the empty tags.

What should have happened instead?:
The two problematic examples are themselves valid HTML. It's confusing to see extra <small> being inserted.

Software version: 1.45.0-wmf.14

Event Timeline

This issue is also present in Parsoid. I'm not sure how it should be classified.

Izno subscribed.

This is either a "working as intended, see also how RemexHtml works" or a functional duplicate of T134469: doBlockLevels() inserts <p> and </p> randomly with no regard for HTML validity. The easiest way to deal with any of these is to remove the newline internal to the small tag.

Thanks for triaging. I think the latter one is a better fit. Sometimes it's necessary to realize that wikitext is a weird thing that happens to be mixed with HTML tags :(