Open
Bug 763383
Opened 13 years ago
Updated 5 years ago
execCommand("delete") doesn´t remove empty span-elements
Categories
(Core :: DOM: Editor, defect, P5)
Tracking
()
UNCONFIRMED
People
(Reporter: friba77, Unassigned)
Details
User Agent: Opera/9.80 (Windows NT 5.1; U; de) Presto/2.10.229 Version/11.64
Steps to reproduce:
Entered two characters, selected both of them and changed them to bold with execCommand("bold"). The result was:
<span _moz_dirty="" style="font-weight: bold;">xy</span>
Then i set caret and deleted both characters with the delete-key.
Actual results:
The empty span-element hasn´t been deleted. The result is:
<span style="font-weight: bold;"></span>
Expected results:
Empty span-elements should be deleted recursively.
Demo to test: http://www-archive.mozilla.org/editor/midasdemo/
![]() |
||
Updated•13 years ago
|
Component: Untriaged → Editor
Product: Firefox → Core
QA Contact: untriaged → editor
I don´t know why, but there are different results.
midasdemo: a<strong>bc</strong>d
my own testscript: a<span style="font-weight: bold;">bc</span>d
Your testpage also shows another problem with execCommand:
1) type in: abc
2) delete these characters with the delete-key
Then switch to 'View HTML Source'. You will find a <br>. This <br> is inserted as soon as you delete the last character.
My function to get a text bold:
function command(command) {
try {
if (isSelected()) {
if (!execCommand)
throw new Error(errorNotIn);
if (!document.execCommand(command, false, null))
throw new Error(errorFalse);
}
else alert(errorRange);
}
catch(error) {
alert(error.message);
}
}
input type="button" value="fett" onclick="editor.command('bold');" />
This creates <span style="font-weight: bold;"> elements.
I have found a difference between our scripts. I work with:
<div id="editor" contenteditable="true"></div>
And you work with:
<iframe id="edit" width="100%" height="200px"></iframe>
I think this is the reason why we get different results.
And i think thats also the reason for my problem. See my first entry (description).
Comment 6•5 years ago
|
||
Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.
If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.
Severity: normal → S4
Priority: -- → P5
You need to log in
before you can comment on or make changes to this bug.
Description
•