Reputation: 13400
As HTML code reviewer, sometimes reading an html code I see something like this:
<form class='form' …>
Even if it is allowed, I am wondering if this kind of stuffs, having class name equal to the tag name, should be deprecated independently by the context.
P.S.:
possible context:
<form class='form'>
</form>
<div class='form'>
</div>
Upvotes: 3
Views: 1029
Reputation: 201588
Class names should be considered as being selectable by authors or communities of authors by agreement. I don’t think it’s appropriate to “deprecate” names just because they look odd on first sight. The word “form” may have different meanings in different languages and communities. There might be all kinds of reasons for something apparently odd like <form class="form">
even if class names have been taken from English. In inspecting code, such constructs should raise question, not trigger automatic disapproval.
(I almost proposed closing the question as non-constructive. But maybe there is some value in pointing out the problems in the assumptions behind the question.)
Upvotes: 1
Reputation: 10012
It would make no sense to have the class be the same name, the whole point of classes is so you can assign an obvious naming structure to an element so e.g.
.login-form { }
.shopping-form { }
If the form has the class name of form to it just means it has a poor naming structure and if the form class is applied to all forms then they may as well of just applied to it to:
form { }
not
.form { }
So while it's allowed it's just bad practice and unnecessary if they are just using one class for all forms.
Upvotes: 3