Opened 2 years ago

Last modified 2 years ago

#14754 confirmed Bug

Removing anchor doesn't remove link's id attribute

Reported by: Karen Ananiev Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

Steps to reproduce

  1. Create any link
  2. Select the link and create anchor
  3. Remove anchor

Expected result

There are no name and id attributes

Actual result

The link still has id attribute

Other details (browser, OS, CKEditor version, installed plugins)

Change History (4)

comment:1 Changed 2 years ago by Jakub Ś

Status: newpending
Version: 4.5.10 (GitHub - master)

I can't reproduce that. When you create link to anchor the code looks like below. There are no ids assigned to link.

<p><a href="#test">#test</a></p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><a id="test" name="test"></a></p>

Could you perhaps provide screen cast for this problem?

comment:2 Changed 2 years ago by Karen Ananiev

If you have link:

<p><a href="http://example.com">TEST</a></p>

And add an anchor to that link:

<p><a href="http://example.com" id="test" name="test">TEST</a></p>

And then remove the anchor using the context menu you will get:

<p><a href="http://example.com" id="test">TEST</a></p>

Expected id attribute to be deleted as well as name.

comment:3 Changed 2 years ago by Jakub Ś

Status: pendingconfirmed

Ok, so you are creating a link, select it and create anchor on it. Next you remove the anchor and id stays.

Lines responsible for removing the anchor within the link are located here: https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/link/plugin.js#L742-L745

I’m not convinced that removing id in all cases is a good idea but it would make sense to remove it when it is the same as name attribute. We could add compare statement there if id and name are the same, we could remove both.

comment:4 Changed 2 years ago by Karen Ananiev

Yes, I think that condition is a good idea. Thanks!

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