The value of HTML validation
This post has been percolating in my mind for some time, and reading Chris Heilmann’s post about Remy Sharp’s site. Chris and I have had more than a couple exchanges about this very topic and we’ve had to agree to disagree in the past. I’ve been very vocal, both publicly and privately, about my disdain for the current state of HTML validation. To understand my position, you first need to understand what the HTML validator does.
What is HTML validation?
The HTML validator performs several checks on your code. The major ones are:
- Syntax validation - checks for syntax errors. Technically
<foo bar="baz">is correct syntax even though<foo>is not part of HTML, so syntax validation alone is minimally useful for writing good HTML. - Tag nesting validation - checks that elements are closed in the reverse order in which they were opened. This catches those instances when a
<div>isn’t closed appropriately, for example. - DTD validation – checks that your code follows the patterns specified in the DTD. This includes validating tag names, attribute names, and tag embedding (which tags are allowed inside of others).
- Outlier validation – checks for anything appearing in the code that was not mentioned in the DTD. Custom tags and custom attributes are the common findings.
Keep in mind that these are logical validation tasks and not necessarily how the validator is implemented. If any one of these checks fails, the HTML is considered invalid. And therein lies the problem.
The argument
The argument for HTML validation is typically along the lines of ensuring interoperability across multiple browsers. Every browser has a different parser and feeding it what everyone agrees to understand is the only way to be sure your code will work everywhere it should. Since each browser has different error-correction mechanisms in their HTML parser you cannot rely on invalid code to behave in predictable ways.
The argument against HTML validation is that it’s too strict and doesn’t allow for how browsers actually work. Yes, the HTML may technically be invalid, but all browsers handle some invalid HTML similarly (note: not often exactly the same). If I’m willing to take responsibility for the invalid code I’m writing, I shouldn’t have to worry about validation. All I care about is that it works.
My position
This is one of the few times that I’ll ever publicly make a statement of position on something, so enjoy. I’ve always been in the camp that’s against validation on the grounds that the HTML validator is far too strict to be practical in real-world scenarios. There are things that browsers widely support (<noscript> in <head>, <script> after </html>) that are invalid yet sometimes very necessary for delivering the correct user experience.
Practically speaking, though, my big problem with HTML validation is in task #4 (flagging outliers). I’m a big believer in the use of custom attributes on HTML elements for providing additional meta data related to a particular element. To me, it just makes sense to add a foo attribute when I have bar data that I need associated with it. Sometimes people overload existing attributes for this purpose just to ensure that their code validates even though the attribute is being used in a way in which it was never intended. That doesn’t make sense to me.
The dirty secret of browsers is that they never perform HTML validation against a DTD. The doctype you put at the top of the document switches the parser into a particular mode of operation, but no operations involve downloading the doctype and verifying that the code matches. What does this mean? It means that a basic syntax parser handles HTML, with exceptions specified for self-closing tags and block vs. inline elements (and I’m sure other situations as well).
In the case of custom attributes, all browsers parse and consider syntactically-correct as real attributes, thus making them accessible through the DOM via JavaScript. Not only do browsers not break while parsing custom attributes, they parse correctly and are treated like any other attribute! So why would I be worried about this? I will continue to use custom attributes and am very glad that HTML5 formalized them as datasets.
The best example of a technology that causes invalid HTML but has incredible importance is ARIA. ARIA works by overlaying additional attributes onto HTML 4. These attributes provide additional semantic meaning to HTML elements and the browser is able to transmit those semantics to assistive devices designed to help differently-abled people experience the web in a usable way. All major browsers currently support ARIA markup. Yet if you add in those attributes, all of a sudden you have invalid HTML.
I don’t feel as strongly about custom elements, which are discarded as part of error-recovery. Personally, I think that throwing custom elements into a page in a syntactically-correct way should be okay, but I don’t see a very strong use case for doing so.
To be clear on my position: I strongly believe that tasks #1 and #2 are fundamentally important and should be done all the time. Task #3 I’d place as important but less so than the first two. Task #4 is of questionable importance to me as it relates to custom attributes. At a maximum, outliers should be flagged as warnings just to double-check that you didn’t misspell an attribute name. Flagging custom elements as errors is probably a good idea, though has some downsides as it relates to embedding of other markup content such as SVG and MathML (essentially, each of these needs to become a specific exception in the parser).
Validation for the sake of validation?
Let me say this as strongly as I can: validation for the sake of validation is just plain silly. Valid HTML means just that all four tasks completed without errors. There are a lost of things that valid HTML does not guarantee:
- Valid HTML does not guarantee accessibility
- Valid HTML does not guarantee a good user experience
- Valid HTML does not guarantee a functioning site
- Valid HTML does not guarantee the layout is correct
Having valid HTML code may be a badge of honor that gains you some geek cred, but it is not a measure of success in and of itself. Your code isn’t necessarily better at doing its job than mine.
HTML5 validation
HTML5 validation fixes some of the issues that I and others have with HTML 4 validation. It explicitly allows ARIA attributes and you can add your own attributes so long as they begin with data-. All of these cases are considered valid HTML5 and satisfy me vs. HTML 4 validation. To be clear, there are still some parts of the HTML5 validator that I disagree with, but I do believe it more accurately reflects real-world use cases than the HTML 4 validator.
Conclusion and please keep civil
I do believe that parts of the HTML validation service are incredibly useful, but I won’t be held hostage because I’m using custom attributes. I’m proud of using ARIA roles in my day job and couldn’t care less if that makes the HTML 4 validator unhappy. Again, of the four tasks that are part of the validator, I only have a problem with one of them. And the HTML5 validator takes care of most of my issues.
I know this is a hot-button issue that will likely spawn several more threads and blog posts. I already have this disclaimer at the comment form, but please keep all further discussion civil and productive. I know there are people who come down very strongly on each side of this argument and everyone has valid points (no pun intended). It would be great to get a good, strong debate going in the comments, but let’s make sure tempers are kept in check. This should be an intellectual debate, not an emotional one. That being said, I’m going to be moderating the comments even more heavily than usual – so play nice!
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.
Both comments and pings are currently closed.




32 Comments
It seems too harsh to say “I’ve always been in the camp that’s against validation.”. Perhaps it would be better to say you don’t feel it’s necessary for a good page to pass the W3C HTML Validator with no errors. Validation isn’t evil, it’s just insufficient.
To me, HTML validation is like “lint” in that the tool will give messages to the effect of “Are you *sure* you know what you’re doing there?” It’s found plenty of problems for me in the past, as has jslint. The biggest problem I have with the W3C validator is that you can’t turn off some of the warnings and errors, but that’s a failing of the tool that reflects its all-or-nothing philosophy.
It would be great if the validator took after lint and had a way for us to declare which “rules” we were intentionally breaking, perhaps in an HTML comment so it was self-documenting as well. This kind of thing is especially important when you’re working in a page written by someone else and you have no idea whether the markup is anything close to sane.
Dave Methvin on August 17th, 2010 at 10:07 am
I think a person’s need for validation will be 100% dependent upon their current skill level. It’s not a black and white issue — validation is good vs. bad. It absolutely has its place — particularly for those who are just beginning to get their feet wet in this field. The problem is when it becomes an absolute: your code *must* validate, and not doing so is unprofessional. Many readers on Nettuts+ will spend hours rewriting certain sections of their code in order to pass validation — despite the fact that their code worked perfectly before, but maybe used some vendor-specific CSS3 styling… or a custom attribute. That’s when it becomes more of a hindrance than a help, in my opinion. Does it really matter whether we’re using the underscore hack in our CSS, or something more official, like “* html #elem” to target IE6? Maybe so; maybe not.
It’s just another tool.
Jeffrey Way on August 17th, 2010 at 10:12 am
One thing you must consider is trust.
By validating your documents, you gain the trust of users.
It shows you have taken the time, care, and attention to detail in your work.
A trusted standards body like W3C also provides third-party trust for your validated documents. It works in the same way as showing Verisign, SSL or Visa on your checkout. Users will gain trust because a ‘more respected/known’ organisation has been involved with your website at some stage. This is just one reason why I always validate my documents.
Carl Walker on August 17th, 2010 at 10:46 am
I also think that #1 and #2 are the things one should always do. If the document is at least (somewhat¹) well-formed the vast majority of annoying markup glitches were already successfully avoided. Unlike regular validation, this kind of sloppy (or lenient) validation works great for automated tests. There won’t be any false positives – only true positives which point at really horribly broken stuff.
[¹ E.g. accepting things like non-closed image, p, br, or hr tags.]
If you want to put some junk it custom attributes… well, HTML5 legalized just that. Just prefix your attribute with “data-” and it’s alright (since this prefix was reserved for this very purpose).
@Jeffrey
>Does it really matter whether we’re using the underscore hack in our CSS,
>or something more official, like “* html #elem†to target IE6?
I used to prefer separate override stylesheets loaded via conditional comments. But they are very annoying from a maintenance standpoint. They also drag you down from the very beginning.
Selector hacks are bad insofar that they change the specificity of the selector… which leaves us with underscore and star attribute prefix hacks.
I used to hate them since they make validation impossible. However, if you filter out those lines which contain a star or underscore hack and also those which start with a vendor prefix, then a validator will be helpful tool again.
I also found that using a good editor makes validators somewhat obsolete. The errors are highlighted right away. So, you’ll usually have fixed all real issues long before you press Ctrl+S.
Jos Hirth on August 17th, 2010 at 10:53 am
Just wondering – what’s the use case for using the tag after ?
As an intermediate proxy developer, I can tell you that content after the end of the tag can make life very difficult…
Yoav Weiss on August 17th, 2010 at 11:15 am
Just wondering – what’s the use case for using the “script” tag after the end of “html” tag?
As an intermediate proxy developer, I can tell you that content after the end of the “html” tag can make life very difficult…
Yoav Weiss on August 17th, 2010 at 11:16 am
Here is a newbie take on the importance of validation:
At the moment I would not be comfortable putting any code out into the world that does not validate…because I am not competent enough to argue why my “invalid” code is actually good code in its particular set of circumstances.
However, a number of sites including Google have code that is invalid when put through a validator. After you reach a certain level of competence and can explain why invalid code is actually good code (that is the code would fail the checks performed in number 3 and/or 4 but changing the code to pass these checks would either hamper the efficiency or just be an inelegant solution) validation for the sake of validation is more of an excuse for maintaining the status quo.
I also think that the whole argument that code must validate according to standards is sometimes used as an excuse for not keeping up with new developments…e.g. HTML 5 is not a standard and therefore I am not going to learn it until 2022
Trisha Cornelius on August 17th, 2010 at 11:20 am
I have had a serious issue with custom attributes.
What if the browser chooses to implement them in the future?
For years I used a custom required=”required” attribute to control JavaScript validation, and now HTML 5 uses that attribute. I am stuck going back and changing tons of code to have data-required=”required”, and changing my JavaScript validation to look for the new attribute.
Kirk Cerny on August 17th, 2010 at 11:44 am
@Dave – You disagree on how I’ve always felt?
@Yoav – The use case for the late script tag is that it can be automatically appended to the bottom of each request for tracking purposes. Yahoo! uses this technique a lot to add boilerplate code at the bottom of every page. We literally have no control over whether or not the page gets stamped, it’s part of the Apache configuration.
@Kirk – The problem you describe is a general problem with code extension rather than a problem with custom attributes. You can easily work around that problem through naming conventions. We used to prepend “y-” in front of our own attributes. You can just as easily choose another prefix (see the “aria-” attributes described as part of ARIA), but I do believe the prefix is important for maintainability and ensuring future compatibility.
Nicholas C. Zakas on August 17th, 2010 at 12:38 pm
[...] hoje me passaram no twitter um excelente artigo intitulado “The value of HTML validation“, escrito por Nicholas C. Zakas falando de tudo que eu gostaria de escrever e indo muito [...]
O real valor da validação HTML | A fronteira final on August 17th, 2010 at 1:03 pm
I do believe that even though validation isn’t sacred it still useful and a “best practice” that should be followed whenever possible… – most of the times validation errors are simple mistakes that can be easily fixed and it indeed helps to: reduce chance of cross-browser issues, avoid conflicts with 3rd party code, make your code “more future-proof”, etc… – we can’t be sure about how new browsers will handle HTML and the standards are the only guide we have about how things are supposed to work…
the addition of custom tags and attributes to HTML5 is a really good idea but should be used with moderation.
CSS validation for me was always bullshit since a valid CSS is less-likely to render properly on all the browsers… validators should help developers to find problems, not cause more.
reminder for the zealots: “program for users not for validators”..
reminder for the pragmatics: “it’s not because you can do that you should abuse”..
cheers.
Miller Medeiros on August 17th, 2010 at 3:49 pm
Nice post. This solved one of the problems I was facing yesterday. I tried to give width attribute to a TD element while working in XHTML 1.1 Strict mode and width attribute was surprisingly working. Infact all the presentations attibutes which are not allowed in Strict DTD were just working fine and in mobile browsers as well. Although the HTML was found invalid by the validator. I got the cause in your post. “The dirty secret of browsers is that they never perform HTML validation against a DTD. The doctype you put at the top of the document switches the parser into a particular mode of operation, but no operations involve downloading the doctype and verifying that the code matches.”
Amit Agarwal on August 18th, 2010 at 3:53 am
Hi Nicholas
I’ve worked on numerous websites requiring a certain accessibility level and I’ve actually just gotten back from a meeting regarding the test results of a should be accessibly website. I can say, there’s nothing I don’t agree on in your post above. If it increases the level accessibility I will use attributes such as aria-required in form input elements. HTML validators to me are more a guideline and debugging help. It’s nice if a page validates but that’s all there’s to it. As you have mentioned in your post, there are no other reasons or guarantees a valid page gives you or the user.
Cheers
tj
TJ on August 18th, 2010 at 5:26 am
For a classroom setting, I think it’s worth it for beginners to work towards HTML validation so they can learn what what the strict side is like. Later on they can bend the rules to their needs as they’ll have already mastered the hardest part.
At least now I don’t feel so bad for occasionally using target=”_blank” on my hyperlinks.
Jose Galdamez on August 18th, 2010 at 10:22 am
Great article.
What is your position on using XHTML and XML namespaces to extend elements and attributes?
Rick
Rick Roth on August 18th, 2010 at 1:07 pm
I don’t have an opinion on this topic but I enjoyed the post, it answered a couple of questions that were subliminally lurking for sometime now. Cheers! – Vishal G
Vishal Gupta on August 18th, 2010 at 11:27 pm
For what it’s worth, I completely agree with you on every single point you make. Here’s one of my favorite posts / discussions on this topic back in 2004 when XHTML 1.0 validation was the hot geek credential to have.
http://www.mikeindustries.com/blog/archive/2004/06/march-to-your-own-standard
Here’s the best part: “By invalidating my entire site with this one line of code, I ensure that I am made aware the instant it matters. The instant this stuff starts to break anything in the real world, I will know. If I only had a few small errors on a few random pages around my site, I could easily miss the day when “the big switchover†happens and wind up with broken pages I don’t know about. And since this code is in the form of a server-side include, I can freely remove it with a few clicks.”
Andrew Mattie on August 19th, 2010 at 1:49 pm
This is a topic that I have been back and forth on for a number of the reasons discussed in the article and the comments. I am very interested in opportunities to get early feedback through automated code analysis.
HTML is the foundation of the pages we build for web applications and today, there seems to be absolutely no good way to do worth while static code analysis on HTML. Validating against the W3C spec is not necessarily what I am after, but it serves as a starting point.
I agree with most everyone that points #1 and #2 are most important. I have not spent a lot of effort automating these steps yet, though, because I think they are the least likely to benefit from automated code analysis. This is because of the fact that they are the most likely to produce a big enough error that the developer or QA team will find it fairly early and get the issue addressed. Don’t get me wrong, automating this will of course catch more of these earlier and more easily, but I still feel the value is in #3 and #4.
Going against a lot of the feedback above, I feel the #3 and #4 are the most important, but with the following important point. I need the ability to configure each, both by making them more restricting and making them less restrictive. Let me give a few examples, I agree that custom attributes are a good way to make markup more semantic if done in a proper way. Allowing those attributes by adding a namespace to what is allowable by the validator could be a away to allow that. The aria, data, and y namespaces were good examples. On the other side of this point, I want to also remove some attributes from what is allowable by the validator. Even though obtrusive JavaScript is allowable by the spec, I want to make sure that members of my team that may not be as familiar with JavaScript best practices are reminded that the use of onClick, onChange, etc attributes are not allowable in the coding standards of my team. This is a very specific example, but I hope it gets my point across. I want validation based on the W3C spec, but not limited by it for the purpose of doing static code analysis based on the coding standards agreed upon by my team.
Finally, while we are on the subject, I want to describe my other gripe about the current state of HTML validation. I want static code analysis. I do not want to slow down this process by submitting each page that I want to analyze to a server, even through an API, and then having to parse the response. I want to be able to kick off an Ant script (or name your build script of choice) and have a very fast analysis, similar to the analysis done by tools like JSLint (there is an Ant task available that works very well for this). The limitation that complicates this further is the need to capture static HTML files from a dynamic application, so this can be a fast analysis, but this is a task that can be accomplished separately in a number of ways.
Matt Travi on August 19th, 2010 at 1:53 pm
@Carl user trust has never been a motivator for me to validate code on the projects I’ve done. Users don’t even know what HTML is let alone valid HTML. So I guess I’m saying is most people like say my family that surf the web are oblivious to any of this.
I do agree with your statement “It works in the same way as showing Verisign, SSL or Visa on your checkout.” as far as buying stuff is concerned but that’s a different topic.
Blake on August 19th, 2010 at 9:24 pm
I disagree that argument for validation is for ensuring interoperability between different browsers, unless you’ve inherited a ‘this site is best viewed in IE4′ website, in which case good luck.
For me the biggest value comes from the having a tool that can run through large amounts of code in a small time and pick out typos, omissions and mistakes. If you try to take it as law rather than guidance, you are going to hit an obstacle as soon as one of your URLs has an ampersand in it.
The past couple of jobs I’ve worked on have been to take over and polish a codebase towards the end of a project, here’s some examples of what it has helped me find and fix:
1) jumping between photoshop, and IDE and a browser, the developer forgot to add in an alt attribute to the img elements they were writing.
2) developer had a brain-fart and wrote checked=”true” rather than checked=”checked”. The daftness of checked=”checked” is a discussion all in its self, but it is the standard that we all expect, what would you do an extended find for if you wanted to find all inputs set to be checked by default?
3) developer wanted an entire area to be a link and didn’t realise that it isn’t valid or assistive-technology-friendly to put block elements inside an anchor
Journos have spell- and grammar-checkers, developers have validators. A spellchecker won’t stop you from writing gibberish as long as the gibberish is spelled correctly. A spellchecker also won’t pick up on new or technical terms. I’ll bet a few of us here have JavaScript, XSLT or AJAX entered into our Custom dictionaries.
DB on August 20th, 2010 at 11:39 am
[...] I know that HTML validation doesn’t matter (see also “The value of HTML validation”), but I do like using it as a lint tool (and yes, I prefer to just see a green favicon in the title [...]
JeffreyBarke.net » Blog Archive » Internet Explorer 8: The X-UA-Compatible meta element and conditional comments on August 22nd, 2010 at 2:40 pm
I think a HTML validation tool is very good for beginners to learn and improve their code. Remember that new programmers could misuse some tags. Additionally, it is always necessary to have a kind of guidelines in order to avoid the chaos.
I think the validation should be less strict and work like JSLint, checking for errors and bad practices like divitis and classitis with the ability to enable and disable some features.
Thanks!
Teylor Feliz on August 24th, 2010 at 9:54 am
@DB – those ampersands are precisely the types of things that we would hope a linting tool like I described. They should be easy to find and easy to correct by encoding them dynamically. Although, these are not issues that would likely cause big problems, they are easy broken windows to fix. Fixing small problems like these keeps the team honest and more in line with the coding standards of the team.
Matt Travi on August 24th, 2010 at 10:50 am
[...] The value of HTML validation by Nicholas C. Zakas (August 17, 2010) I do believe that parts of the HTML validation service are incredibly useful, but I won’t be held hostage because I’m using custom attributes. [i.e. ARIA] [...]
Web Standards, Accessibility & More » Is HTML Code Validation Necessary? on August 24th, 2010 at 11:36 pm
I agree with a lot of the points made including that:
1. Validation isn’t everything
and:
2. Neither should we completely discount it
If you don’t need the badge of honor then don’t worry about it. I practically live in HTML and I personally don’t (at the present time) really need custom attributes. Apart from that, if you really know how to write your code it will simply flow from your brain to your fingers to your keyboard in a valid way. Saying validation isn’t the most important thing to you because you use custom attributes a lot is one thing and probably okay. But a lot of coders produce tag soup then go to the validator to find out what they did wrong. Or they produce tag soup (and I have seen horrendous code in very high profile sites) and don’t validate it. Maybe the site still works but the cleaner the code is from the beginning the easier it will be to maintain and debug.
Christian on September 2nd, 2010 at 6:09 pm
Just found out this new article lately and now was the only time I was able to make some response. I’m not a geek-like or some sort of genius but I’ll express some of my thoughts regarding this discussion.
First of all, I’m a beginner, so you will have an idea how a beginner thinks about validation. One thing that I always feel (oopss, emotion, hey we’re humans, emotion is one big factor) when I see websites that validates is to always think and/or say “WOW! these guys who created this website really worked hard and I want to be like them.” What I feel about websites that gives importance to validation is that they are professionals that everybody should be like to make the web have one good future. And I’m always “proud” of them, because they are not simply creating websites for money and/or business, but also for Web standards.
This is my first encounter to the word “ARIA”, I never read that from any books or tutorials where I learned creating markup and style sheets, so I will skip discussing it (since I really don’t know it), but for the discussion’s sake, if ARIA really helps assistive devices that well, then I’ll let all my pages invalidate for the sake of user experience, since the real goal of web developers should be to create websites and/or applications that will meet user’s needs and experience, moreover, people with disabilities should be our top priority (It’s my opinion that once we can satisfy disabled users, then normal users will be absolutely just fine).
Finally, correct me if I’m wrong, but I think Mr. Nicolas is against validation only because web pages that uses useful codes and/or snippets isn’t able to pass validation, and I would agree with him. But I guess, using Progressive Enhancement as a building block when creating websites will solve this issue (something like, create websites from read-only text with working links, then try some validation, if it doesn’t validate, then fix it first before progressing to another advanced technology – at least you will be assured that the validation errors isn’t cause by bloated markup, but only because of the new technologies).
I know I have a lot to learn from this kind of issues, but at least, in a beginner’s perspective, I can say that we really value validation. It’s an indication for us that we are doing the right thing – because hate tag-soup and we don’t want into becoming one. And for people who will be able to validate web pages even though with tag-soup and/or bloated codes, I think that would be a rare scenario, since generally, when you are taught about the importance of validation, you are likely to understand and apply semantics – which wages war from the improper use of tags.
E-Jelome on September 3rd, 2010 at 2:12 pm
Validation isn’t the be all and end all; and intentionally not validating when you have a good reason is pragmatic and desirable but wilfully bad markup because you you imagine it’s not important to get it right has negative consequences (beyond what some people might conclude about your technical ability).
I’ve seen it cause interoperability problems in browsers many times over the last 15 years – especially on less commonly tested platforms like mobile browsers but also incompatibility with browser extensions and systems which parse content like Safari’s Reader.
Having written XML and HTML (and HTTP) parsers in various languages (for the web; in scripts and in desktop applications) I’ve also felt the pain there and seen what happens when people get encoding wrong (including a spectacular fail that resulted in several hundred DSL PPP authentication passwords set incorrectly because someone encoded a single character wrongly).
Minor issues (such as those cited) tend not to be problematic in practice; It’s the horribly broken stuff like <a> (e.g. incorrectly encoded characters, mismatched quotes, mixed use of quotes; all combined) which is where the issues arise and where other developers have to deal with the mess left by others. Sadly this is what you get on the Yahoo! front page (note: it varies when you refresh).
I expect a lax approach to markup is going to be less tolerable as we move towards more semantic web content (as it is an absolute impedance to that end).
Iain Collins on October 14th, 2010 at 12:49 pm
The parser for the blog comment system just mis-parsed my post above which is why the second to last paragraph doesn’t seem to make sense… Just saying …
Iain Collins on October 14th, 2010 at 12:54 pm
@Iain – I fixed your wonky markup in the previous comment. As I said in the post, validation doesn’t ensure a good user experience, it only ensures the validator likes your code. Since browsers don’t actually validate (and have different parsers with different error correction mechanisms) this provides very little benefit above and beyond syntactic validation.
The parts of the Yahoo! homepage that don’t validate are all known. Some are there because the code is generated outside of our page (i.e., ads) and we have no control over that – unless it breaks the user experience, at which point we can get people to fix it. We have an excellent QA team that finds important issues that affect users.
Now, I know that it’s incredibly difficult to write a parser that handles the tag soup mess of HTML we find in the wild. Yet every browser has done this and it’s our job, as web developers, to ensure that our code works in all of those. Validation doesn’t ensure that; actual testing does. I’m happy to have invalid HTML if that improves the user experience (such is the case with ARIA attributes) and don’t feel like I need to pacify the validator.
Nicholas C. Zakas on October 14th, 2010 at 3:27 pm
To clarify I regard that you did not actually fix my ‘wonky markup’ which, some what ironically, was a deliberate example of the just the same format of invalid and mismatched markup I found on the Yahoo! home page and I feel you have mis-represented what I actually submitted in doing so.
Your position on this seems to me quite polarised and entrenched so I will not attempt to persuade you further but thank you for providing the opportunity to so do and leave it at that.
Iain Collins on October 15th, 2010 at 5:41 am
[...] 原文:http://www.nczonline.net/blog/2010/08/17/the-value-of-html-validation/ [...]
翻译:HTML验è¯çš„价值探讨 | 所谓技术 - è£çº¸åˆ€ä¸‹ on October 22nd, 2010 at 4:47 am
[...] What if we strive for at least a 75% score? I understand the thinking, as I thought that way too at one point; though, again, it’s irrelevant. When validating, your primary focus should be on determining where you’ve made mistakes. Validation isn’t a game, and, while it might be fun to test your skills to determine how high you can get your score, always keep in mind: it doesn’t matter. And never, ever, ever compromise the use of the latest doctype, CSS3 techniques and selectors for the sake of validation. The dirty secret of browsers is that they never perform HTML validation against a DTD. The doctype you put at the top of the document switches the parser into a particular mode of operation, but no operations involve downloading the doctype and verifying that the code matches. What does this mean? It means that a basic syntax parser handles HTML, with exceptions specified for self-closing tags and block vs. inline elements (and I?m sure other situations as well). – Nicholas Zakas [...]
But it Doesn?t Validate | wpthemefree on November 29th, 2010 at 4:44 pm
Comments are automatically closed after 14 days.