Closed
Bug 257519
Opened 20 years ago
Closed 20 years ago
Backspace at the beginning of a paragraph creates an EMPTY tag
Categories
(Core :: DOM: Editor, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 244392
People
(Reporter: mihai.bazon, Assigned: mozeditor)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040810 Debian/1.7.2-2
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040810 Debian/1.7.2-2
Pressing Backspace when the caret is at the start of a paragraph (or probably
any block-level node) makes the editor create an empty tag! That is, the HTML
code will look like: <>foo</>. Sometimes (can't give exact steps yet) the
browser crashes few operations thereafter.
Reproducible: Always
Steps to Reproduce:
1. Go to the given URL ( http://www.dynarch.com/htmlarea/examples/core.html )
2. Press CTRL-A (select all text) then DEL. Then switch to CODE mode (press the
"<>" button in the toolbar). Enter the following HTML:
<p>foo</p>
<p>bar</p>
3. Switch back to WYSIWYG mode (press "<>" again). Then place the caret in the
second paragraph, before letter "b", and hit BACKSPACE.
Actual Results:
The browser will remove both paragraph tags and show the following text (in
WYSIWYG mode):
foo
bar
If you hit the mode button again ("<>" in the toolbar) the HTML code will look
like this:
<>foo<br />bar</>
As you can see, the browser removes both paragraph tags and creates an empty
tag. I suspected an error in my code but can't find any :-\ I added an
alert("|" + range.startContainer.parentNode.tagName + "|") in JS and the result
was "||", indicating that indeed we have an ELEMENT node with no tag!
Expected Results:
Pressing BACKSPACE should remove the second paragraph and append its content to
the first paragraph, resulting in the following code:
<p>foo|bar</p>
where "|" indicates the caret position.
Tested this with FireFox 0.9.3 for Linux, Mozilla 1.7.2 for Linux and FireFox
0.9 for Windows (under XP).
I am thinking to fix this directly in JS by intercepting BACKSPACE, but I'm sure
the problem lies in the Midas code and should be fixed there; also, if I
workaround it from JS I'll invalidate the Undo queue (but I guess that's
"alright" since I break it in multiple places anyway..).
Reporter | ||
Comment 1•20 years ago
|
||
Oops, same thing happens when you press DEL at the end of the first paragraph :-/
Comment 2•20 years ago
|
||
*** This bug has been marked as a duplicate of 244392 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Updated•20 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•