I was looking at the source code for camelize and I am unclear what the following line does:

var camelizedString = this.indexOf('-') == 0
        ? oStringList[0].charAt(0).toUpperCase() +
                oStringList[0].substring(1)
        : oStringList[0];

From what I can tell the function will turn something like "project-edit" into projectEdit. Looks like prototype uses this for converting between CSS style syntax for CSS properties and Javascript style syntax for CSS properties.

What I don't get is the case where the string start with "-". The function splits the string on "-" and assigns that to oStringList. If the string starts with "-" won't that mean the first element of oStringList is an empty string?

I am guessing this function is trying to deal with the browser specific CSS properties such as -moz-outline but it seems that code does nothing. Seems that you could just do:

var camelizedString = oStringList[0];

and achieve the same thing. Am I missing something?

Eric

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to