Ticket #1271 (closed Bug: worksforme)
Opera: Small space is appended when applying styles to collapsed selections
|Reported by:||fredck||Owned by:||hallvord@…|
|Component:||Core : Styles||Version:||SVN (FCKeditor) - Retired|
This bug is a follow up to #253. This specific feature has been introduced for that ticket, but Opera presents a strange behavior.
Steps to Reproduce
- Load sample01.html;
- Place the cursor in the middle of the word "some". For example, after the "o";
- Press CTRL+B several times. The toolbar will behave correctly to the command, but note that a small space is added for each time it get pressed.
Analyzing the DOM after CTRL+B, all we have is "so<b></b>me", with the selection inside <b>. That was our intention, but the small space get rendered for the empty <b>.
The code which applies the style can be found in the "_ApplyInlineStyle" function in fckstyle.js. It can be condensed to the following code, which is the only way we have found to make it work with Opera:
// Here the <b> tag is build. var collapsedElement = this.BuildElement( range.Window.document ) ; collapsedElement.innerHTML = ' ' ; range.InsertNode( collapsedElement ) ; range.MoveToNodeContents( collapsedElement ) ; range.Select() ; FCKSelection.Delete() ;
To note that "range" is FCKDomRange, not a standard DOM Range object.
- Status changed from new to assigned
- Owner set to hallvord@…
comment:11 Changed 6 years ago by hallvord@…
- Status changed from assigned to closed
- Resolution set to worksforme