Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

How does one ensure that HTML, CSS and JS have uniform identifiers. For example, one such set of identifiers could be class names. e.g.:

CSS:

.user-profile{
  ...
}

JS:

document.getElementsByClassName( "user-profile" ).(...)

HTML:

<div class="user-profile"> ... </div>

Are there any IDEs that can provide this functionality? Given that these are technically strings, I'd assume it would be hard to determine 'equality'.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There are no variables in HTML. I think you are talking about id and class attributes.

When you change an id or a class, the easiest way to reflect the change in CSS and JavaScript is to grep the related files.

I'm not sure an automated renaming by an IDE would be helpful: there are many cases where you don't want CSS/JavaScript files to be modified. A basic example: you change a class of an element, because you want a different style.

Also, if you have to do a lot of changes in ids and classes, check that you're using proper naming conventions and you chose the values thoughtfully from the beginning.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.