Are invalid attributes valid?
How bad is an invalid attribute? Robert Nyman asks the question and mentions the invalid attributes that .NET controls tend to output as an example of when you can live with a few harmless validation errors if the project deadline is so tight that you have to cut corners.
Obviously if there just isn’t time to fix errors that won’t prevent anyone from using the site, there may be more important things you should spend your time on. But I think that leaving invalid attributes in your markup is something you should think very carefully about, for several reasons:
- It makes quality assurance more difficult. How much time will you have to spend scanning through the list of errors reported by the validator, looking for “real” errors?
- Who will decide and take responsibility for which errors are harmless and which need to be fixed?
- How will you explain to your clients (assuming they are the kind of clients that care about validation) why their sites do not validate? How much time will you need to spend on teaching them the difference between harmless and potentially catastrophic validation errors?
- What’s next? Allowing invalid elements? Not caring too much about well-formedness? Leaving invalid attributes in your markup may be the start of a slippery slope. It doesn’t have to be, and in Robert’s case I know it won’t be, but the risk is there.
In my opinion, leaving invalid attributes in your markup should be seen as a last resort.