Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Clean up bogus BR elements #75

Open
OliverJAsh opened this issue Mar 20, 2014 · 6 comments
Open

Clean up bogus BR elements #75

OliverJAsh opened this issue Mar 20, 2014 · 6 comments

Comments

@OliverJAsh
Copy link
Contributor

Browsers need to insert something inside of an empty element in order for the caret to be positioned there (AFAIK). You wouldn’t be able to place your caret inside of <p></p> because there’s no text node/element.

This hasn’t been fixed because there were bigger fish to try, but could easily be done as a “formatter” (perhaps).

@OliverJAsh OliverJAsh added the bug label Mar 20, 2014
@hassankhan
Copy link

I think this example is related, the following lines:

Test line 1

Test line 2

Become:

<p>Test line 1</p><p><br></p><p>Test line 2</p>

@OliverJAsh
Copy link
Contributor Author

@hassankhan Can you elaborate? I don’t see this happening when I paste (from a plain text editor).

@hassankhan
Copy link

I typed it in (don't know if that makes a difference?) on the demo page and that was the generated markup.

Shouldn't the correct markup be:

<p>Test line 1</p><br><p>Test line 2</p>

@OliverJAsh
Copy link
Contributor Author

@hassankhan The sample text you included has two new line characters in it — by this I’m assuming you’re sending the ENTER key twice. If this is the case, your output HTML is correct. We create a new paragraph (P element) each time the ENTER key is sent. The correct HTML in this case:

<p>Test line 1</p><p><br></p><p>Test line 2</p>

Alternatively you can send the SHIFT+ENTER keys which will create a BR element instead of a P.

<p>Test line 1<br>Test line 2</p>

Does this help?

@hassankhan
Copy link

Ahh right, thanks, that was exactly what I was looking for. Sorry to clog up the issue, I read the title and thought it was related.

@icodeforyou
Copy link

Is there any progress update on this issue? We are finding the bogus <br> very annoying in our project.

if (! this.allowsBlockElements()) {
    // Set bogus BR element for Firefox — see explanation in BR mode files.
    content = content + '<br>';
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants