Opened 17 years ago

Last modified 17 years ago

#667 new Bug

[SS] Combination of a link and a style

Reported by: anonymous Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version:
Keywords: SF Discussion Cc: Frederico Caldeira Knabben, bngobngo@…

Description (last modified by Frederico Caldeira Knabben)

Following situation:


  • developer runtime (uncompiled scripts)
  • fckstyles.xml
<Style name="Fat link" element="a">
    <Attribute name="class" value="aBold" />
  1. there is nothing more in the editor then 2 plain words without any formatting
  2. select one word and create a hyperlink using toolbar "Insert/Edit link"
  3. enter some target as usual, the hyperlink is created
  4. now while the text is still selected choose the "Fat link" from the toolbar style pulldown menu

IE behavior

crashes with

Unknown runtime error
Line 28 in fckstyledef_ie.js > e.innerHTML =
oRange.htmlText ;
May be it is a IE bug...

FF behaviour

Firefox has 2 conditions

  1. if the text is still selected it messes up the code
New document -> New <a class="aBold"><a
href="bala.ccc/" />
  1. if the word has been re-selected it is ok (problem with selection cache?)

In both browsers if the style choise is done first, there are no problems.

This problem is not as big in new documents as in old stuff where hyperlinks exist and have to be "re-styled" or modified.

Best regards


Moved from SF:

Change History (4)

comment:1 Changed 17 years ago by Martin Kou

Reporter: changed from Martin Kou to anonymous

I'm marking this bug to [SS] (Style Selector).

Moved from SF. Original poster: fredck

I can attach a class (style) to a link using the dropdown.

BUT. The color does not get correct. The link is using the color from the default link settings in the css file and not from the selected used class.

Moved from SF. Original poster: bngobngo

comment:2 Changed 17 years ago by Frederico Caldeira Knabben

Description: modified (diff)

Reformatted description for readability.

comment:3 Changed 17 years ago by Frederico Caldeira Knabben

Keywords: Discussion added

The new style system introduced with version 2.5 should bring a consistent behavior for it on both browsers. No errors are being thrown now.

The problem here is that the style is being used to apply a class to existing links, while in effect the editor is trying to apply the <a> element as an style, just like <span>, so it will not merge the class in exiting links, but create new <a> elements, always.

I'm not yet sure how we should handle this situation, and there will be occasions when we could opt to use the styles to create new links too. I would opt to leave the current behavior, and use the link dialog to apply classes to the current link.

comment:4 Changed 17 years ago by Alfonso Martínez de Lizarrondo

Component: GeneralCore : Styles

I think that (taking span and div elements aside) whenever a class or any other attribute is going to be applied and that element already exists in the current selection or its parent hierarchy, then instead of creating a new element it should be applied to the existing one.

That allows to easily style a document or change any other property because first the html tags are placed and then the user can change the properties of those elements.

In fact I would say that the style combo should try to create as less elements as possible, for example creating <a class="foo">selected text</a> looks wrong. The option shouldn't be available unless there's a <a> in the selection hierarchy.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy