I personally use a hyphenated naming convention that prefixes class names, identifiers, data properties, etc. with the abbreviated identifier of the object to which the code belongs, and one for the functionality area.
If I were working on a graphics program for Foo, my prefix could be as follows:
foo-chart-
This allows me to create unique company identifiers for companies and unique areas of code (to avoid collisions with other developers in other areas of functionality).
Thoughtful example:
<button id="foo-chart-refresh" class="foo-chart-interact" data-foo-chart-last="201205031421">Refresh Chart</button> <script type="text/javascript"> var lastRefresh = $('#foo-chart-refresh').data('fooChartLast'); </script>
I believe that using a hyphen works well almost anywhere where my identifiers will be needed - either as a value or attr markup name, or code, etc. You can use any char that suits your needs ( . Very often)
Jaulde
source share