Opened 8 years ago

Closed 4 years ago

#8368 closed Bug (duplicate)

Incorrect DOM structure after applying an anchor style to a selection that already contains a styled anchor

Reported by: Teresa Monahan Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 3.0
Keywords: IBM Cc: Damian, Satya Minnekanti

Description

When a selection contains an anchor that has some styling, and the user tries to apply another anchor to this selection, the DOM structure returned after applying the anchor is malformed.

To Reproduce:

  1. Add the following HTML to the editor through source mode:
    <p>
    	Sample text <a href="http://ckeditor.com"><strong>Anchor </strong></a>more text</p>
    
  2. Switch back to wysiwyg mode and select the entire editor contents.
  3. Click the Link icon on the toolbar and enter a url for the selection e.g. www.ibm.com. Click OK.
  4. Inspect the DOM for the editor contents - see the attached screen capture.

Problem: The DOM contains nested anchor nodes and an empty strong tag.

Note: Do not switch into source mode before inspecting the DOM - this corrects the DOM structure.

This issue causes problems for us in one of our extensions which needs to work with the DOM after the anchor styling is applied.

In the example above, applyInlineStyle from styles/plugin.js is used to apply the anchor to the selection. Is it possible to change the way this handles anchors in the selection to avoid this incorrect DOM structure?

Attachments (1)

Nested Anchor Issue.gif (3.9 KB) - added by Teresa Monahan 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by Teresa Monahan

Attachment: Nested Anchor Issue.gif added

comment:1 Changed 8 years ago by Jakub Ś

Status: newconfirmed
Version: 3.6.2 (SVN - trunk)3.0

Looks like one <a> tag is divided into three because of this strong element inside.

Anyway the issue has been reproducible form CKE 3.0

comment:2 Changed 4 years ago by Piotrek Koszuliński

Resolution: duplicate
Status: confirmedclosed

DUP of #8097. The problem with strong will disappear after fixing the way how the link is applied.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy