PDA

View Full Version : VB adding <br>'s to posts


ToKey
11-27-2011, 07:03 PM
I'm sure someone else has run into this but I haven't seen anything.

This is weird behavior where <br>s are getting added to posts, specifically when using table tags.

For instance, I'll have the following post:

This is where we will keep track of who buys admin and how long they will have it for.
[table]
[tr]
Name
SteamID
Type
[...]

I've tried both with BB table tags and real HTML. On submitting around 100 <br> tags get added to the outputted HTML just before the table tag.

Anyone else run into this? What function is doing this so I can try and fix it.

Lynne
11-27-2011, 07:41 PM
Well, when you type this:
hello
hello again

Then you end up with <br> between lines, so why would you expect any different when using tags?

ToKey
11-27-2011, 11:11 PM
What I'm posting

https://vborg.vbsupport.ru/external/2011/11/25.png

What I'm getting

https://vborg.vbsupport.ru/external/2011/11/26.png

It's not adding one br, it's adding a hundred.

Lynne
11-28-2011, 03:41 AM
I don't know why it's adding a hundred, but did you try putting it all on one line which is what you need to do?

ToKey
11-28-2011, 05:34 AM
I don't know why it's adding a hundred, but did you try putting it all on one line which is what you need to do?

I see what's happening.

Given the example

<table>
<tr>
<td></td>
<td></td>
</tr>
[...]


The parser will turn it into

<table><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
[...]


Well <br /> elements aren't allowed in these places. Because of that the browser is interpreting it as

<br />
<br />
<br />
<br />
<br />
<table>
<tr>
<td></td>
<td></td>
</tr>
[...]


So in the end it's the browser that is doing, but the parser could be made to check for invalid tags like this and choose not to turn the new lines into br's.

I did find a way around it for now though.

<table><tr><td>Table cell text
</td><td>Table cell text
</td></tr>Table cell text
[...]

Because the br is being placed in the td (a valid place), the breaks don't get moved out of that table AND because there's only one break with nothing after it, most browsers will ignore it, giving you a clean table with no errors.

My one complaint is that it looks really bad for formatting and my mods have difficulty following the pattern when making edits.