Ticket #4351 (closed Bug: fixed)
Dashes cannot be used in attribute names
| Reported by: | niek | Owned by: | garry.yao |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 3.1 |
| Component: | General | Version: | 3.0 |
| Keywords: | Confirmed HasPatch Review+ | Cc: |
Description
The CKEditor htmlParser uses a regular expression to check for valid attributes. This regex however, does not allow dashes to be used in the attribute name.
If I'm correct, dashes are allowed as character in an attribute name, and the "\w" set, does not include the dash. Therefore, the dash should be added separately (like the colon).
htmlparser.js:
- 21. var attribsRegex = /([\w:]+)... + 21. var attribsRegex = /([\w:\-]+)...
Attachments
Change History
comment:1 Changed 4 years ago by tobiasz.cudnik
- Keywords Confirmed HasPatch added
- Milestone changed from CKEditor 3.x to CKEditor 3.1
comment:2 Changed 4 years ago by garry.yao
- Owner set to garry.yao
- Status changed from new to assigned
comment:4 Changed 4 years ago by garry.yao
Design TC updated at : http://ckeditor.t/dt/core/htmlparser/htmlparser.html
comment:5 Changed 4 years ago by fredck
- Keywords Review- added; Review? removed
Looking at the W3C specs, we can see that attribute names accept a complex range of chars. But, let's keep it simple here, stickying with the common cases. So, let's just add "-" and "." to it ("_" is already inside \w).
comment:7 follow-up: ↓ 8 Changed 4 years ago by niek
Please note: In "4351_2.patch", the "." (period) needs to be escaped, it now matches any character!
comment:8 in reply to: ↑ 7 Changed 4 years ago by fredck
- Keywords Review+ added; Review? removed
Replying to niek:
Please note: In "4351_2.patch", the "." (period) needs to be escaped, it now matches any character!
Yes! Be sure to have it escaped when committing.
comment:9 follow-up: ↓ 10 Changed 4 years ago by garry.yao
- Status changed from assigned to closed
- Resolution set to fixed
Fixed with [4349].
comment:10 in reply to: ↑ 9 ; follow-up: ↓ 11 Changed 4 years ago by niek
- Status changed from closed to reopened
- Resolution fixed deleted
comment:11 in reply to: ↑ 10 Changed 4 years ago by fredck
- Status changed from reopened to closed
- Resolution set to fixed
Replying to niek:
You still haven't escaped the dot.
After some internal talk and more research, we confirmed that the dot doesn't need to be escaped inside a character class.
comment:12 follow-up: ↓ 13 Changed 4 years ago by niek
Indeed, you are right! My apologies.
Small suggestion; add a comment to related tickets when discussion these things internally. This way you'll prevent confusion and possible new bug reports (since your last comment stated 'be sure to have it escaped', and the diff doesn't show the escape).
comment:13 in reply to: ↑ 12 Changed 4 years ago by fredck
Replying to niek:
Small suggestion; add a comment to related tickets when discussion these things internally. This way you'll prevent confusion and possible new bug reports (since your last comment stated 'be sure to have it escaped', and the diff doesn't show the escape).
You're right. The committer should have added a small comment about it. Sorry for this small mis-observation, and thanks for the suggestion ;)

You are right, one example of such attribute would be http-equiv.
Thanks for report and the fix.