This project is archived and is in readonly mode.

#956 ✓wontfix
tvr

Improve the String.camelCase regular expression.

Reported by tvr | August 4th, 2010 @ 07:54 PM | in 2.0 (closed)

String.camelCase doesn't seem to cover a few cases. http://jsfiddle.net/hcdGx/

Current expression '/-\D/g'
Proposed expression '/-+(.)?/g'

The proposed replace expression was pulled from Prototype's String.camelize as they have nearly an identical implementation as MooTools' String.camelCase. It seems to me that the replace expression should be more inclusive than non-digit characters '\D'. Thoughts?

Comments and changes to this ticket

  • Sebastian Markbåge

    Sebastian Markbåge August 5th, 2010 @ 12:40 AM

    • State changed from “new” to “hold”
    • Milestone set to 2.0
    • Milestone order changed from “788” to “0”

    The real purpose of this is to map between an IDL attribute and a CSS property. There's no agreed upon standard for this algorithm. The CSSOM specification and Mozilla use hard coded values. WebKit internally uses something comparable to: /-./g

    I'm putting this on hold to keep backwards compatibility. We can change this when/if there's a de facto standard or a particular need to handle these edge cases.

  • Christoph Pojer

    Christoph Pojer November 9th, 2010 @ 07:25 PM

    • State changed from “hold” to “wontfix”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Tags

Pages