Grae-Drake / hg-units

http://www.grae.io/hg-units
Other
1 stars 3 forks source link

CSS class and id changes #21

Open Raijinili opened 9 years ago

Raijinili commented 9 years ago

Not doing it now, but I guess I should make an issue as a to-do. Also, we would need to agree upon the names.

Use unique ids instead of classes for unique things.

Cards should have classes for what they have.

(how do i mine for low priority mark?)

Grae-Drake commented 9 years ago

It's generally accepted best practice to use classes over ID's in selectors (http://screwlewse.com/2010/07/dont-use-id-selectors-in-css/), and I'd like to follow that pattern here as much as possible.

Open to using ID's if they are more semantic than classes & (important and) if the change doesn't require creating more complicates CSS selectors. https://2002-2012.mattwilcox.net/archive/entry/id/1058/

Raijinili commented 9 years ago

The first article is about unnecessarily using IDs instead of classes for styling, because e.g. you can reuse that style. I'm suggesting the use of IDs for DOM manipulation. Both of the IDs I mentioned are used in code that assumes there is exactly one element to manipulate, and would probably have issues if there are more.

Not sure what this means, but it might say not to do the second thing I suggested.

Just like you don’t alter the mark-up simply to provide something for the JS to work on. You get the JS to do that itself.

Well, adding resource type as classes also allows you to color the cards somehow to mark their resource types. Pyeontae had a bar that was yellow, blue, green, or black (hybrid) depending on the resource. We can make it half blue and half green for CW hybrids. Well, the templating code might be more complex (slower) and make the resource bar have ratios corresponding to the cost ratios. Guess that's a different issue.