Opened 12 years ago
Closed 12 years ago
#11011 closed Bug (fixed)
Method applyStyle removes attributes from nested elements.
| Reported by: | Jakub Ś | Owned by: | Piotr Jasiun |
|---|---|---|---|
| Priority: | Must have (possibly next milestone) | Milestone: | CKEditor 4.3.1 |
| Component: | General | Version: | 3.0 |
| Keywords: | Support | Cc: |
Description
- Please put attached file in samples folder (code for v3 is commented)
- Select 'some' and apply term style with button
- Select 'is some sample' and apply quote style with button
- Switch to source
Result: data-element="term" is removed
<span class="quote" data-element="quote">is <span class="term">some </span>sample</span>
Problem can be reproduced in every browser from CKEditor 3.0 in both CKE 3.x and 4.x
Attachments (1)
Change History (13)
Changed 12 years ago by
comment:1 Changed 12 years ago by
| Status: | new → confirmed |
|---|
comment:3 Changed 12 years ago by
| Milestone: | → CKEditor 4.3.1 |
|---|
comment:4 Changed 12 years ago by
| Keywords: | Support added |
|---|
comment:5 Changed 12 years ago by
comment:6 Changed 12 years ago by
| Priority: | Normal → High |
|---|
comment:7 Changed 12 years ago by
| Owner: | set to Piotr Jasiun |
|---|---|
| Status: | confirmed → assigned |
comment:8 Changed 12 years ago by
| Status: | assigned → review |
|---|
I have added the rule to removeOverrides to avoid removing data-* attributes. I have no ideas about others attributes we should thread the same way, I believe data-* attributes are special.
Changes in t/11011 and corresponding test branch.
comment:9 follow-up: 10 Changed 12 years ago by
| Status: | review → review_failed |
|---|
- Wouldn't
indexOfbe better thansubstr? - It would be good to have a test that even though data-* attr wasn't removed, the next one after it was, so we'll know that loop wasn't terminated completely.
comment:10 Changed 12 years ago by
| Status: | review_failed → review |
|---|
Replying to Reinmar:
- Wouldn't
indexOfbe better thansubstr?
No. indexOf is slower, because if it does not find 'data-' at the beginning it will look for match. Anyway I replaced substr with slice because the second one is standardized.
- It would be good to have a test that even though data-* attr wasn't removed, the next one after it was, so we'll know that loop wasn't terminated completely.
Good idea. Done.
comment:11 Changed 12 years ago by
| Status: | review → review_passed |
|---|
- Rebased both branches.
- Pushed one very minor commit to each branch.
comment:13 Changed 12 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_passed → closed |

We need to define a rule of thumb for this. By default we're removing duplicated attributes in nested elements. Only data-* attributes will be an exception?