Page MenuHomePhabricator

Tokenizer's self-closing tag detection is tripped up by presence of /> in HTML attributes
Closed, DeclinedPublic

Description

See below:

[subbu@earth mocha] echo "<span title='a /> b'>c</span>" | parse.js --lint > /dev/null
[info/lint/self-closed-tag][enwiki/Main Page] {"type":"self-closed-tag","params":{"name":"span"},"dsr":[0,17,17,0]}
[info/lint/stripped-tag][enwiki/Main Page] {"type":"stripped-tag","params":{"name":"SPAN"},"dsr":[22,29,null,null]}
[subbu@earth mocha] echo "<span title='a /> b'>c</span>" | parse.js --trace peg | head -1
0-[peg]        | ---->   [{"type":"SelfclosingTagTk","name":"span","attribs":[{"k":"title","v":"a ","srcOffsets":[6,11,13,15],"vsrc":"a "}],"dataAttribs":{"tsr":[0,17],"stx":"html","selfClose":true}}," b'>c",{"type":"EndTagTk","name":"span","attribs":[],"dataAttribs":{"tsr":[22,29],"stx":"html"}}]

Event Timeline

ssastry renamed this task from Tokenizer's self-closing detection is tripped up by presence of /> in HTML attributes to Tokenizer's self-closing tag detection is tripped up by presence of /> in HTML attributes.Jul 13 2017, 2:51 PM
ssastry triaged this task as Medium priority.
Arlolra subscribed.

This is by design to match T97157

$ echo "<span title='a /> b'>c</span>" | php maintenance/parse.php 
<div class="mw-parser-output"><p><span title="a"></span> b'&gt;c</span>
</p></div>