New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to turn off dash case for CSSClass directive #3001
Comments
@pflannery why it is causing issues for you in practice? AFAIK css class names are not case-sensitive (https://developer.mozilla.org/en/docs/Case_Sensitivity_in_class_and_id_Names) and you can't have mixed cases in your HTML markup.
Could you be more precise? What is the exact use-case?
This wouldn't work as 3rd party components would be dependent on app's settings and thus could break without warning. Once again, I would be keen on knowing more about your exact use-case. It sounds like you might have mixed-case in your CSS classes (which is not great) and then trying to replicate this markup in your HTML. |
@pkozlowski-opensource The problem comes with using and writing libraries that follow camel case guidelines like OOCSS or using libraries like animate.css Camel case is my preference over dashed case. For me I would have to convert all my previous libraries over to dashed case or would be forced to write them all as lower case (for angular) to get around the dash case transformer. I personally want to keep readability using camel case classes both in code and html.
Then perhaps a separate directive is a better approach? |
OK, I see, this is only for readability then, right?
As it is coded today, this conversion affects all the places where a CSS class is set on an element, so a separate directive wouldn't work / isn't enough. @tbosch maybe we are too aggressive about this conversion and should do it only when a CSS class name comes from HTML attribute value (that is, when using |
I don't see how a choice of CSS class names causes an issue. Could you provide a working example demonstrating the problem. |
Hi all! I also came into this issue. Here s how it goes: As you can see, I used an expression to bind the class of the element. ResultAs you can see in the actual output I don't have that darker blue color (from the expected output). Best regards, |
@TiagoBraga39 as quick work-around make sure that your CSS class names are lower-cased (which makes sense anyway, since browsers are not dealing with case-sensitive CSS) |
@pkozlowski-opensource The thing is I actually have a ton of css classes with capital letters, which worked on NG1, and now I can't use them in NG2? |
This is why I marked it as a work-around. |
I've found a case where the work-around doesn't work. It baffled me for a while because at first I was sure that classes are case sensitive but then I realised that it's because my angular project didn't have a doctype defined and when I added I think the ability to output as WYSIWYG would resolve this. |
@mhevery I've tried to post a working plunker example but cant get angular to work there. I always see "require is undefined"..if you have a template from plunker or fiddler etc.. I'd be happy to try demonstrate |
@pflannery Note 1, It's just an Hello World Sample with 2 cdn: Note 2, About the traceur options It also goes with google traceur and couldn't find system 0.18 cdn, but for the sake of the plunker it should be fine. Best regards, |
@TiagoBraga39 thank you very much! Here is an example of the issue http://plnkr.co/edit/StVbjnVMWWnBZPtVQSsu?p=preview |
Yup, same behaviour. |
+1 on maintaining original capitalization and dashes. We use css class names such as |
Just verified myself: |
Fixes angular#3001 BREAKING CHANGE: View renderer used to take normalized CSS class names (ex. fooBar for foo-bar). With this change a rendered implementation gets a calss name as specified in a template, without any transformations / normalization. This change only affects custom view renderers that should be updated accordingly.
Fixes #3001 BREAKING CHANGE: View renderer used to take normalized CSS class names (ex. fooBar for foo-bar). With this change a rendered implementation gets a calss name as specified in a template, without any transformations / normalization. This change only affects custom view renderers that should be updated accordingly. Closes #3264
Hi, tnx for not de-normalizing the CSS class name |
Thanks for the change. It's better than before but still not working as expected. Tried the following with alpha 33. While using |
@amoizp you are talking about a different issue here. You need to keep in mind that HTML is not case-sensitive nor case-preserving, so if you type |
@pkozlowski-opensource Got it, thanks. So far, our upgrade to angular 2 is working out very well. Keep it up guys! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm finding problems with css that uses camel case when using CSSClass because this line automatically converts each class to dashed case.
Can we have a choice between camel case and raw input when using the CSSClass directive?
Would be nice if we could provide a means to configure CSSClass directive per component.
The text was updated successfully, but these errors were encountered: