Opera: Small space is appended when applying styles to collapsed selections
|Reported by:||fredck||Owned by:||hallvord@…|
|Priority:||Must have (possibly next milestone)||Milestone:||Opera Compatibility|
|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.
Change History (14)
Changed 10 years ago by fredck
Changed 10 years ago by hallvord@…
comment:9 Changed 9 years ago by hallvord@…
- Owner set to hallvord@…
- Status changed from new to assigned
comment:11 Changed 9 years ago by hallvord@…
- Resolution set to worksforme
- Status changed from assigned to closed