Grow your CSS skills. Land your dream job.

Validation: It’s your cross browser compatability friend!

  • Rob
    # July 24, 2009 at 7:39 pm

    Hey guys – I just wanted to post to say please please please before you post a question about how things are not working in IE or something like that can you please run your code through the w3 validator.

    The reason I say this is a huge amount of problems can be caught by the validator. So please run it through first and fix the major problems (it doesn’t have to fully validate), it will save you time trying to fix issues quickly and it will help us here from saying the same thing over and over :D

    http://validator.w3.org/

    much love!

    - Mod Team.

    # July 27, 2009 at 4:26 am

    It’s a thumbs up from me.

    8-)

    # July 29, 2009 at 2:51 pm

    absolutely right ! :D

    # August 7, 2009 at 9:20 am

    No. Death to the Validator! :mrgreen:

    Reasons:
    1) Your advice is an advice everybody already knows. It’s like waching up to the sky to know how the weather is.

    2) W3C-Vadidator is often unable to analyze non-enclosing-tags with

    Code:
    />

    the right way. He does not understand empty elements like

    Code:
    .

    and wants me to write

    Code:
    />

    the right way.

    3) Everybody is talking about HTML5, but there is a by far better way to produce markups that machines can understand: the role-attribute. But the validator says, role-attrbutes are false in my xhtml-document, though the X stands for extensible.

    4) Finally, the validors often says something is invalid on my page. But when I take a look in markup of the validator protocoll page I discover the same mark-up. Obviously it can’t be invalid if the W3C uses it.

    For everyone who knows the concept of xhtml, validating is just spell-checking. Are all my p-Tags closed?

    # August 7, 2009 at 10:40 am

    Keep in mind…

    – #1: No, not everyone knows to validate. CSS-Tricks has a lot of visitors who are learning web design for the first time. Seasoned web designers know to validate. Beginners often don’t. Validating will help teach them the right way to code, and hopefully remove some frustration when things aren’t displaying like they should.

    Validation — especially for beginners — is important because it is an easy way to catch problems with the code. If the code is valid, it helps with cross browser compatibility. It’s a heck of a lot easier to deal with browser quirks if you have valid code to start with.

    – #2: This depends what doctype you are using. And yes, to respond to your specific example: it does understand the <script type="text/javascript"… etc bit — this validates just fine:

    Code:
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">






    and it also validates just fine when using "<script type="text/javascript" src="anyscript.js" />". Technically, if you are using XHTML, which uses "/>" endings, you probably should be using "<script type="text/javascript" src="anyscript.js" />".

    In most cases, you aren’t supposed to be using empty tags anyway, so this shouldn’t be an issue.

    – #3: Yes, well, do all browsers support the role attribute? No. Then it’s a non-issue, and you can’t feasibly use it anyway. Remember, IE6 and 7 can’t actually display XHTML as real XHTML anyway — it is served as text/html, rather than true XHTML. (Things to keep in mind: http://lachy.id.au/log/2005/12/xhtml-beginners, and http://www.456bereastreet.com/archive/2 … _properly/). Besides, if XHTML is properly served by the web server as XHTML, any errors in the page will break the page. Well-formedness errors are fatal. (Validation is just spell checking? Doesn’t seem like it.) In that case, you’d better validate, otherwise your page won’t show!

    – #4: Web designers/developers can get lazy. Just because other sites don’t always validate — even the WC3 — is no reason that your own sites can’t/shouldn’t, especially when most validation errors shouldn’t be an issue if you are coding according to the HTML/XHTML rules anyway. (And, as far as I can tell, the http://validator.w3.org/check does use valid code).

    All this being said, validation isn’t perfect. There are times — as an experienced web designer — when you can, and perhaps should, break validation. However, if you know what you are doing, and you aren’t being lazy, you shouldn’t run into many significant validation errors anyway.

    # August 7, 2009 at 12:51 pm
    "runa" wrote:
    Reasons:
    1) Your advice is an advice everybody already knows. It’s like waching up to the sky to know how the weather is.

    That entire post made me so angry, fortunately Falken hit up all the points already, so all I have to say is, "You’re an idiot."

    Good day sir.

    # August 8, 2009 at 9:18 pm
    "TheDoc" wrote:
    "runa" wrote:
    Reasons:
    1) Your advice is an advice everybody already knows. It’s like waching up to the sky to know how the weather is.

    That entire post made me so angry, fortunately Falken hit up all the points already, so all I have to say is, "You’re an idiot."

    Good day sir.

    Hahaha. Your Prognosis is in!

    Good rebuttal Falken.

    # August 10, 2009 at 5:09 pm

    Okay, I see. It is not against wellformed code or the validator itself, it is against the validator as a detection tool to figure out why a page is rendered falsely in a browser.

    @Falken After you tried do explain the world of markup to me you come the very same conclusion as I did: Validation is not perfect. May I repeat the first statement of this thread:

    Quote:
    I just wanted to post to say please please please before you post a question about how things are not working in IE or something like that can you please run your code through the w3 validator.

    I do not agree with this advice. That is what I am talking about. The validator is not the right tool for checking why the browser does not render your markup the way you want him to do. Frankly, it is the wrong tool in every way. The validator informs you about the relation between your markup and the W3C standard, absolutely not about rendering problems in a browser. Validating has really nothing to do with parsing and rendering. Safari for instance does not parse and render the W3C standard. Safari renders Apple’s interpretation of text documents containing recommendations what the standard should be. So, you cannot learn to know the standard when watching how Safari displays your markup.

    If you see a chaos in the browser preview, first check if a tag is not closed properly. Syntax highlighting in the editor, Firebug and a pair of human eyes is by far the better way to check this. But never ending divs that turn your page into disaster is what this thread is all about. If you re-read the first entry, valid code is not the thing we talk about.

    Making the page run perfectly in all browsers is unlike validation. So the big four browsers won’t never support the role-attribute. It would be totally useless. Semantics are meaningless to normal browsers (except screen readers). What they want is syntax that fits to their built-in instructions to render elements. They don’t look up the Doctype spec and the DTD-file you have specified in your page header, they definitely do not validate a page, they have a set of tags hardcoded in their knowledge base. They may know to close forgotten tags when they read transitional, but what has this to do with the validator?

    So, why validating? What does the validator do for the users of my site:
    1. human beeings who see the content,
    2. human beeings who listen to the content,
    3. machines that try to understand the markup semantically (bots, screen readers, api),
    4. machines, that only try to render the syntax of the markup (browsers)?

    Every webdesigner should think about this with on his own. He should not listen to advices of people who have heard other people’s advices about the Validator. Asking the Validator why my xhtml-strict sucks in IE6? :D

    Finally, let’s talk about beginners. Do you really want them to check their IE-rendring with the validator? Robskiwarrior really says nothing about standard-compliant code in his entry. Tthis is what the validator checks, incomplete tags are just one single point of the xhtml-standard which will be detected by coincidence. But Robskiwarrior talks about nothing else than rendering problems. My advice to beginners: Use your eyes or Firebug for browser-checking. Read the W3C specifications for learning well-formed code.


    @Thedoc, I looked at the markup of your website and validated it with the validator. Are you really sure, that I am an idiot? Besides many other invalid things (and half-valid things that are worse that invalid ones), your pages has also most of the same problems I quoted recently. May be you want to mail to the W3C to inform them, that they are idiots too.

    By the way: Why did you put "You’re an idiot" in quotation marks? The quotation marks are wrong.

    Rob
    # August 10, 2009 at 5:30 pm

    lol – the controversy over a small statement that helps beginner coders find errors in their code – awesome. quick lets get on to politics and religion!!!

    Runa – its your right to disagree, still doesn’t make you correct. I was merely pointing people in a direction that helps to save them from embarrassing "oh I forgot to close the tag" moments or not adding a doctype…

    You are an idiot.

    Topic locked.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Validation: It’s your cross browser compatability friend!’ is closed to new replies.

*May or may not contain any actual "CSS" or "Tricks".