Opened 15 years ago
Closed 15 years ago
#4589 closed Bug (expired)
Output style attribute "override" by regular expression is ignored
Reported by: | pomu0325 | Owned by: | Garry Yao |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.2 |
Component: | Core : Styles | Version: | 3.0 |
Keywords: | Cc: |
Description
For example, following override setting unintendedly matches all <font> element whatever attribute it has.
config.fontSize_style = { element : 'span', attributes : { 'class' : '#(size)' }, overrides : [ { element : 'font', attributes : { 'class' : /^foo/ } } ] };
'CKEDITOR.tools.clone()' seems not to clone RegExp object properly at line.89 of styles/plugin.js
styleDefinition = CKEDITOR.tools.clone( styleDefinition );
After this line, regular expression is turned into , therefore it matches anything.
Attachments (3)
Change History (10)
comment:1 Changed 15 years ago by
Changed 15 years ago by
Attachment: | 4589.patch added |
---|
comment:2 Changed 15 years ago by
Keywords: | HasPatch added |
---|
Changed 15 years ago by
Attachment: | 4589_2.patch added |
---|
comment:4 Changed 15 years ago by
Owner: | set to Garry Yao |
---|---|
Status: | new → assigned |
Beside the RegExp fix there, the array clone could be further simplified - Array is simply first class Object in JavaScript.
comment:5 Changed 15 years ago by
Keywords: | Review? added; HasPatch removed |
---|
comment:6 follow-up: 7 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|
The RegExp part has been merged in [4774] from the 3.1.x branch, so that part isn't needed.
I've done a quick test and it seems that the behavior remains the same if the code for the Array object is removed. Maybe it was added due to problems with some browser? If no one finds problems with that I guess that it could be removed.
Changed 15 years ago by
Attachment: | 4589_3.patch added |
---|
comment:7 Changed 15 years ago by
Keywords: | Review- removed |
---|---|
Resolution: | → expired |
Status: | assigned → closed |
Replying to alfonsoml:
The RegExp part has been merged in [4774] from the 3.1.x branch, so that part isn't needed.
The problem described at this ticket was fixed already by [4774].
...Maybe it was added due to problems with some browser?
It's not targeting a specific browser, just to make the array clone codes simpler.
It seems to be a side-effect of [3704], 'clone' method now doesn't clone RegExp properly.
reproduce
expected result
Only the <font> element which matches the regular expression should be overrided.
actual result
Although 'class="bar"' doesn't match the regular expression, it is also overrided.
This problem is simply avoided by just cloning RegExp object. Is there any reason RegExp should not be cloned??