Page MenuHomePhabricator

Sanitizer escapes "<p />" instead of allowing a blank paragraph through
Closed, ResolvedPublic

Description

Author: david.sledge

Description:
If an empty <p/> element is used in wiki markup, it's parsed as &amp;lt;p/&amp;gt; the resulting HTML, instead of an HTML paragraph element.


Version: 1.10.x
Severity: minor

Details

Reference
bz10276

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:52 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz10276.
bzimport added a subscriber: Unknown Object (MLST).

david.sledge wrote:

Whoops. I meant:

&lt;p/&gt;

not

&amp;lt;p/&amp;gt;

ayg wrote:

Note that browser support for self-closing tags is, as far as I know, shabby, so it's probably best to translate it to <p></p>.

The paragraph element is a container, so a self-closing tag would probably make little sense in this case. The <br /> tag would be more appropriate, or correctly using the paragraph tag as a <p>container</p>, or using the wiki double-spacing syntax (which is parsed as <p> tags).

It might be better to discourage the use of bad markup, rather than encourage it by hacking it into working.

DannyS712 claimed this task.
DannyS712 subscribed.

Not sure when, but this is no longer the case.
The wikitext

Empty paragraph tag below:

<p />

Empty paragraph tag above:

at https://en.wikipedia.beta.wmflabs.org/w/index.php?title=User:DannyS712&oldid=396630 created the html output:

<p>Empty paragraph tag below:
</p>
<p class="mw-empty-elt"></p>
<p>Empty paragraph tag above:
</p>

as well as adding the category for Pages using invalid self-closed HTML tags

DannyS712 removed a project: User-DannyS712.