Reputation: 11064
While creating a jQuery widget, what convention should I use to name my CSS classes. jQuery uses a 'ui-' prefix followed by the plugin name and a class specific name (example : ui-datepicker-header).
Should I use this convention? Or is the 'ui' prefix "reserved" for jQuery's official use only?
Upvotes: 1
Views: 384
Reputation: 382666
Avoid using "reserved" one, use your own but make sure that overall name does not conflict with any of existing plugins/widgets.
Upvotes: 0
Reputation: 625037
When deciding things like this, think about how someone knowing nothing about your code would read it.
I wouldn't use the "ui-" prefix because such a person might think it's jQuery UI related.
You don't need to use a prefix. In most cases this is "noise". If everything starts with "foo-" why have it? It makes sense for a library because then you can easily distinguish what "belongs" to the library. For your own code, it's assumed that everything that doesn't belong to a library belongs to your application.
Pick a meaningful name for each thing that is short but not too short.
Upvotes: 1