Open Bug 603881 Opened 14 years ago Updated 2 years ago

deleting the entire content of contenteditable div containing an empty div as child is deleting even the empty div.

Categories

(Core :: DOM: Editor, defect)

x86
Windows 7
defect

Tracking

()

UNCONFIRMED

People

(Reporter: tgvrs_santhosh, Unassigned)

Details

(Whiteboard: DUPEME?)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
Build Identifier: version 4.0b6

deleting the entire content of contenteditable div containing an empty div as child is deleting even the empty div.

For Example, load the below htm code.


<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<HTML>
<HEAD>
<title>Div Test</title>
</HEAD>
<BODY>
	<div contenteditable="true" id="sampleDiv">Mozilla<div></div></div>
	<br/>
	<div contenteditable="true" id="sampleDiv">Mozilla<span></span></div>
</BODY>
</HTML>

Now, delete the first "Mozilla" text. The Div has an empty div as child initially. Now, if you see the html structure from firebug, the empty div has been deleted.

At the same time, try deleting the second "Mozilla" text. The Div has an empty span as child initially. Now, if you see the html structure from firebug, the empty span is there.

The behavior should be same for both and i expect deleting the entire text content should not delete the empty div.

Reproducible: Always

Steps to Reproduce:
load the below htm code.


<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<HTML>
<HEAD>
<title>Div Test</title>
</HEAD>
<BODY>
	<div contenteditable="true" id="sampleDiv">Mozilla<div></div></div>
	<br/>
	<div contenteditable="true" id="sampleDiv">Mozilla<span></span></div>
</BODY>
</HTML>

Now, delete the first "Mozilla" text. The Div has an empty div as child initially. Now, if you see the html structure from firebug, the empty div has been deleted.

At the same time, try deleting the second "Mozilla" text. The Div has an empty span as child initially. Now, if you see the html structure from firebug, the empty span is there.

The behavior should be same for both and i expect deleting the entire text content should not delete the empty div.
Actual Results:  
deleting the entire text content is deleting the empty div child.

Expected Results:  
deleting the entire text content should not delete the empty div child.
Version: unspecified → Trunk
web-ex recording of the bug.
Component: General → Editor
QA Contact: general → editor
This is a dupe of another bug, but I don't have enough time to track down that bug # right now...
Whiteboard: DUPEME?
Hi Ehsan,

As you mentioned, I tried to track the bug which is same as this one but i failed. Can you help me in tracking down the bug?
Hmm, I didn't seem to be able to find the duplicate bug that I had in mind...

https://codepen.io/SaschaNaz/pen/rNVdOPg

Seems the behavior is reversed, now the span disappears but not div.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: