Opened 9 years ago
Last modified 9 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
- Create any link
- Select the link and create anchor
- 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 9 years ago by
Status: | new → pending |
---|---|
Version: | 4.5.10 (GitHub - master) |
comment:2 Changed 9 years ago by
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 9 years ago by
Status: | pending → confirmed |
---|
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.
I can't reproduce that. When you create link to anchor the code looks like below. There are no ids assigned to link.
Could you perhaps provide screen cast for this problem?