Ticket #4351 (closed Bug: fixed)

Opened 5 years ago

Last modified 5 years ago

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

4351.patch (658 bytes) - added by garry.yao 5 years ago.
4351_2.patch (645 bytes) - added by garry.yao 5 years ago.

Change History

comment:1 Changed 5 years ago by tobiasz.cudnik

  • Keywords Confirmed HasPatch added
  • Milestone changed from CKEditor 3.x to CKEditor 3.1

You are right, one example of such attribute would be http-equiv.

Thanks for report and the fix.

comment:2 Changed 5 years ago by garry.yao

  • Owner set to garry.yao
  • Status changed from new to assigned

Changed 5 years ago by garry.yao

comment:3 Changed 5 years ago by garry.yao

  • Keywords Review? added

comment:4 Changed 5 years ago by garry.yao

comment:5 Changed 5 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).

Changed 5 years ago by garry.yao

comment:6 Changed 5 years ago by garry.yao

  • Keywords Review? added; Review- removed

comment:7 follow-up: ↓ 8 Changed 5 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 5 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 5 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 5 years ago by niek

  • Status changed from closed to reopened
  • Resolution fixed deleted

Replying to garry.yao:

Fixed with [4349].

You still haven't escaped the dot.

comment:11 in reply to: ↑ 10 Changed 5 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 5 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 5 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 ;)

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