Bug 12315 - Clearing out editable div leaves a a <br> tag inside
Summary: Clearing out editable div leaves a a <br> tag inside
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-18 11:22 PST by Dan Wood
Modified: 2007-03-06 23:59 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Wood 2007-01-18 11:22:50 PST
To reproduce:

0. Launch Blot_editableDiv_showSource, my modified version of "Blot" available from <http://dan.karelia.com/webkit/Blot_editableDiv_showSource.zip> with DYLD_FRAMEWORK_PATH pointing to TOT.  (I'm using r18941)

1. Click in the top panel
2. Type in a few letters of text
3. Backspace until they are all gone

Results:  In the source (created by dumping innerHTML of the document) leaves a <br> tag in the div.

Expected: The div should be empty, as it was before we started editing.
Comment 1 Dan Wood 2007-01-18 12:25:20 PST
The above test was done with just a really simple html page, e.g. <html><body> ... </body></html>.

I noticed that if you use a XHTML strict DTD, then the markup is even worse!

<div><br class="webkit-block-placeholder"></div>

The contents of the div shoudl be empty, and  yet instead we have this extra div tag and the BR with an internal class. (Plus note that the tag doesn't self-close.)
Comment 2 Matt Lilek 2007-01-18 13:23:46 PST
Related to bug 12153?
Comment 3 Dan Wood 2007-01-18 13:33:51 PST
Yes, it might be related --but  this is a more general case, with an easy-to-confirm test.
Comment 4 Justin Garcia 2007-03-06 23:59:49 PST
>In the source (created by dumping innerHTML of the document) leaves a
> <br> tag in the div.

Empty divs have no height.  That's why we insert placeholders.  The fact that we prop open ones that are empty in the source is a convenience.

> I noticed that if you use a XHTML strict DTD, then the markup is even worse!
> 
> <div><br class="webkit-block-placeholder"></div>
> 
> The contents of the div shoudl be empty, and  yet instead we have this extra
> div tag

I can't reproduce this.

Finally, the fact that the placeholders have a special class on them is covered in 12317.

Given all this, I'm closing this bug.  Re-open it if you can still reproduce the bug where an *extra* div is inserted when the contents of the editable root are removed.