savetheinternet / Tinyboard

The better imageboard software
http://tinyboard.org
Other
367 stars 306 forks source link

Putting two links to the same post together breaks inline-expanding.js #124

Closed ctrlcctrlv closed 11 years ago

ctrlcctrlv commented 11 years ago

I noticed this bug months ago and ignored it but it's been coming up often on my /b/ board. I can't work out how posts are being marked up so I'm just going to report the bug. Please fix ;_;

Test case:

Post this:

>>140
>>140

(where 140 is another post in the thread)

The generated markup is this:

<a onclick="highlightReply('140');" href="/test/res/82.html#140"><a onclick="highlightReply('140');" href="/test/res/82.html#140">&gt;&gt;140</a></a><br/><a onclick="highlightReply('140');" href="/test/res/82.html#140">&gt;&gt;140</a>

Basically, a bug in the PHP code is causing <a> tags to be nested.

When inline-expanding.js attempts to do this, we get a TypeError:

Uncaught TypeError: Cannot read property 'src' of undefined

If I edit the markup manually to this:

<a onclick="highlightReply('140');" href="/test/res/82.html#140">&gt;&gt;140</a>
<br/>
<a onclick="highlightReply('140');" href="/test/res/82.html#140">&gt;&gt;140</a>

The error is resolved.