Validation Zealotry and Markup Exploitation

Posted: February 25, 2008 Comments

There were a couple of posts published within the past week which struck me as quite interesting. The first, published by Jeff Croft is an opinion piece regarding standardistas who feel the need to denounce invalid markup as an inferior product. The next, by Mike Cherim is based upon his fear that a listitis plague may be upon us.

Validation zealots

I’ve written my fair share on markup validation, and I do think it’s important to validate your code. I’d like to be explicit in saying that when I speak of my OCD only stretches to my own work. There is an abundance of invalid code sprawled across the Internet.

Jeff Croft recently wrote Your Markup Validator, an article focused on this exact issue. He’s got a few choice words for those who feel obliged to publicly note the ‘inferiority’ of invalid code. While I’ve incorporated validation into my workflow, that’s as far as it goes. Reflecting on my past work in Web development, including an initial learning phase, I don’t believe I’ve ever tried to validate the markup of a document I didn’t create (save for glancing at the HTML Validator Firefox extension).

I simply don’t see a need for validating the work of others. I’m not sure why anyone would take the time to do such a thing, let alone bring it up in any type of public fashion. The important thing is to realize the benefit of validation for yourself, and the impact invalid markup has on a document. When you’ve gained this knowledge, you’ll compensate your workflow to make any adjustments necessary. Public mockery of invalid markup is unacceptable.

As Jeff states, validators are debugging tools used to help you better your markup as you see fit. Validators are not a scale to live up to, and they’re certainly not a scale to measure the work of someone else.

A successor to divitis?

In an interesting observatory post by Mike Cherim, some abuse of list elements is exposed. Mike took the time to analyze some specific recurring examples of list misuse and after reading the piece, I had to admit that I’ve noticed a similar trend. While it may appear that I’m contradicting my stance on validation zealotry noted above, like Mike, unless directed at myself, I don’t go around calling people out on something I may feel is an oversight. Mike fears that lists are becoming the new tables and we may be facing a mutation of divitis.

Continuing, Mike’s first example of list abuse is associated with forms. Using lists to structure a form has been a long-standing discussion among many developers. I’ve never used a list to mark up a form, as I don’t see data entry in this way as something that fits within a list. I feel you’re marking up a form and you’ve got a number of elements to work with. Using fieldsets & legends alone give your form some semantic structure, and incorporating some choice separation elements (such as a div or two) can produce great result. As raised in the comments there could be some circumstances where a list may be applicable within a particular form, but I agree with Mike in that a list shouldn’t be a structural foundation.

Misusing specific elements in a way not intended, especially for presentational purposes, while creative and admirable on many levels, simply isn’t right.

– Mike Cherim

Mike continues by exposing more circumstances in which lists are becoming increasingly abused, each with a bit of opinion regarding why it can be looked at as misuse. I was glad to see that Mike and I share an opinion surrounding effective calendar markup. I’d like to suggest that you take a few minutes to read Mike’s piece and check out the comments for a bit of back-and-forth.

Get my newsletter

Receive periodic updates right in the mail!
  • This field is for validation purposes and should be left unchanged.

Comments

  1. I read Mike’s last week and was going to comment, but it would have just been the “i agree” kind of comment, so not really adding anything to the conversation. Jeff’s post came in last night and I cracked up. He’s so blunt about it, but so right.

    I feel like people are sort of hypocritical about things though. On the one hand you get someone who hates invalid code, but the same person has no qualms about using non-semantic HTML to “style” their elements. I don’t get how writing HTML that doesn’t make sense but validates is any better than writing good code that doesn’t.

    Does it really matter if a site doesn’t validate technically, if it functions and reads correctly, and it makes sense with styles off?

  2. @Natalie Jost: Jeff being blunt is one of my favorite characteristics of his. Although I’ve never met him in person, him being so blatant in his writing has him come off as someone I think I’d really get along with in real life. Moving on, I think you’re spot on with confusion in that you “don’t get how writing HTML that doesn’t make sense but validates is any better than writing good code that doesn’t”. I completely agree. I tried to encompass my similar stance when I wrote But it Validates!. The article was inspired by and written in support of Dustin Diaz’s CSS Naked Day, which was and still is a great event. The point to take home is the semantic value of your document, as opposed to whether or not it’s “more valid than hers”. Thanks for stopping by!

  3. Listitis has been going on for a while in the ‘standards’ community. I think after the initial hit of semantic understanding lists are the easiest element to jump on and abuse – because everything is a list. Heck, you can mark-up a paragraph as an OL and that is semantically valid.

    As I once wrote though, the question isn’t whether your use of mark-up is semantically valid, it’s about whether or not your use of the mark-up _adds clarity_ or not. For example, you shouldn’t mark up a paragraph of text as an OL despite the fact that a paragraph is indeed an ordered list of words – because the semantics of the word order is already apparent in the definition of a paragraph. It doesn’t need to be spelt out semantically with an OL.

    I think that most developers, after the initial glut of using ‘semantic’ mark-up in an over-zealous way realise that, and stop over-using (abusing) the semantics of the elements.

    The question to ask yourself is “when does it matter that this is a list?” If it matters in context then mark it up as a list. If not, just type it out as part of your paragraph and be done with it. etc.

  4. I’m with you on the validaton thing. Some people really seem to take it as the holy grail, as if it’s the only thing that matters. There’s a few comments along these lines in Roger Johansson’s most recent article too.

    Like you, I incorporate validation into my process but I don’t go around validating other peoples’ sites or even sites that I created awhile ago. I’m not about to go around valiating every time I (or someone else) changes something on a site just because an unencoded special character breaks the validation.

    I sort of think it’s not a huge deal to have a few errors. Sure, you try to avoid them, you code to standards etc. but it’s unrealistic to get that hypersensitive about the validator. We’ve all got more important things to worry about. I found it kind of odd that some of the commenters in Johansson’s article mentioned that they had to swich to a transitional doctype because some third party code was preventing it from validating. So what???

    I also think that a tendency to focus on validation obscures a lot of the other aspects of web standards.

    I think a lot of that list stuff was inspired by Andy Clarke’s Transcending CSS – he marks up a lot of stuff with lists in there.

  5. Regarding Validation:
    I use my HTML validator Firefox plugin all the time. I use it for my own work to see if I’ve made a mistake while developing, I glance at it when checking out a site such as yours to see if the author practices what they preach, and I use it when evaluating someone applying for job. If I see a warning I’ll look at the code and if the warning is on purpose I have no problem with it. It’s just an easy way for me to know right away if the developer of the site I’m on knows what they’re doing.

    Regarding Lists:
    An address is a definition list. The street address is the title and the city, province, country, and postal code describe the street address. A whole website in a list is just crazy talk.

  6. Hey Jonathan! Thanks for the link! Thanks for getting my point, and thanks for your comments about my bluntness. I think in real life my bluntness comes off as kind of funny and endearing, whereas I think online it is oftentimes taken as angry and jaded (neither of which accurately portray my personality). I’m glad it’s not turning you off. 🙂

    On the “listits” point: abuse of lists (or any semantic element) is a great example of why, as Natalie says, valid code isn’t necessarily better than invalid code. Semantics and validity are both good goals to strive for, but one does not necessarily lead to the other — they’re two totally different things. And, while both are good goals to strive for, in my opinion anyway, neither of them are as important as creating a site that works on all levels, meets the stated goals of the project, and communicates effectively.

    The reality about semantics in (X)HTML is that many things are a judgement call. Forms-as-lists doesn’t really map to MY brain, but I’ve heard smart people make arguments for them and not sound dumb doing it. And, XHTML is sorely lacking on the variety of elements we have available (HTML5 attempts to help, but it’s still way short), so we sometimes have to just pick something and roll with it (e.g., “Yeah, a definition list isn’t really the element I’m looking for, but the element I’m looking for doesn’t exist, so a DL will do for now”).

    A lot of the list abuse is people not knowing better. Some of it is simply people who know a list isn’t quite right, but couldn’t really come up with another element that was (like me, for example — I’ve got some DLs on my personal site that I wish were something else, but that something else doesn’t exist). But most of it is people fanatically trying to adhere to the best practice mentality of always using a semantic element, without really thinking about if that semantic element makes any sense or not. It’s this sort of religious attitude towards web standards (and I mean web standards to the movement, including all the best practices around it, not just the standards themselves) that kind of irritates me. There are a lot of people out there who are using web standards not because they’re the best tool to get the job done, but because it’s the “right” thing to do. I don’t buy into that. The “right” thing to do is whatever gets the job done most efficiently, elegantly, and professionally. Many times, that’s web standards. Once in a while, it’s not. But the point is that web standards are simply a tool that is a means to an end, not the end itself.

    If writing web standards-based sites becomes more important to you than doing what best serves the project, your priorities are all out of whack. And I think that mentality is sort of where the list abuse comes from…doing what’s “right” instead of what’s *best*.

    Whew, that got long fast. Sorry about that. 🙂

  7. @Matt Wilcox: You make a great point; semantics are definitely objective, which is why many arguments result over differing opinions on the subject. I really like your point in saying that your markup should also add clarity to your document, I haven’t heard that phrase used to describe it, but I’m a fan. Thanks very much for leaving your thoughts.

    @Megan: Absolutely. Especially your comment about having to switch to a transitional DOCTYPE; that’s bound to happen from time to time. While technically, by name, it’s defined as a transitional specification, there are times where it’s unavoidable due to third party software integration requirements. It’s not the end of the world.

    @Matt: I think we’re on the same page regarding validation. Seeing a yellow warning or red error will grab my attention for a second or two, but we’re not about to publicly denounce anything and everything about the author because of it.

    @Jeff Croft: Thank you! Thanks for taking the time to leave such an in-depth response. It’s great to see a number of people I follow feel exactly the same way I do about this issue. You’re spot on with saying that Web developers are limited with their markup tool sets. There are only so many elements to work with, sometimes you’ve got to build something with the best tool available. Thanks again very much for leaving your thoughts!

  8. As a college student, it seems my professors are validating zealots, which is quite amusing. Anything you code must validate in order for you to get any credit. It’s like the professors are training “new” validating zealots (the students). It has become habit for me to validate my code, but to validate somebody else’s is ridiculous. Another thing “validating zealots” seem to look for is your coding style (transitional, strict, frameset, etc…). It seems they put others down for not using strict doctype saying, “it’s not completely standards based unless you use strict”. It’s like they think they are better because they code differently. It’s like choosing Linux over Windows (or Mac). It’s all about what works for you.

    All in all, I agree with Jon and Jeff, that validators are tools to help better your markup.

    As for semantic element use, looking back, I was never good at using the best elements for a certain part of the page. For example, when I first started web development I would create a menu like this:

    <div id=”nav”>
    <a href=”#”>Menu 1</a><br/>
    <a href=”#”>Menu 2</a><br/>
    <a href=”#”>Menu 3</a><br/>
    </div>

    Thats what worked for me, but it was messy and didn’t seem right. Now that I understand the elements better, I would code the same like this:

    <ul id=”nav”>
    <li><a href=”#”>Menu 1</a></li>
    <li><a href=”#”>Menu 2</a></li>
    <li><a href=”#”>Menu 3</a></li>
    </ul>

    Using a semantic element cleaned up the code and also added some extra styling options for css.

    I admit, I am kind of addicted to finding the best element to use for a certain part of a website but, I don’t think I have divitis. However, it has helped me understand elements better as well as how I can use them for what I need to accomplish.

  9. @JR: That’s great that your teachers even know what validation is! Most of the students I talk to think Dreamweaver makes the code for you and don’t know anything beyond WYSIWYG editors.

  10. @JR Tashjian: You’ve made a fantastic point, I’m not sure how it escaped me when writing the article itself. When I was in school, it was a requirement that code was completely valid as well. What’s worse is that when I was taking classes, the reasoning behind validation was never touched upon. It was simply dictated as the way things had to be in order to submit your assignments and that was it. Many students were instantly frustrated and turned off by Web standards from the get-go.

    @Matt: That’s the unfortunate truth of “modern” Web development education in many circumstances…

  11. I really like this post. I agree with you. In my country, a lot of companies still insist on having websites designed according to their taste and not their users. Your post will really help me open their eyes and accept the reality.

Leave a Reply

Your email address will not be published. Required fields are marked *