Is there any point in attempting to alter javascript scripts, using escape characters and the like, in order to obtain a clean xhtml w3c validation? Are such clean validations even possible?
A.
Is there any point in attempting to alter javascript scripts, using escape characters and the like, in order to obtain a clean xhtml w3c validation? Are such clean validations even possible?
A.
That's really two separate questions. The first is pretty much a matter of opinion.
Generally XHTML isn't being used correctly anyway. It's for application XML pages, which some browsers still in wide use (most notably IE 8) can't process anyway. Usually it's just served as HTML and error corrected by the browser as HTML 4.01.
That said, you can validate javascript to an XHTML DOCTYPE fairly easily in one of two ways, don't do both, though it won't hurt, it's just extra work:
- Make the script external. The validator won't even see it. This is the preferred method.
- Use not character data comment delimeters at the beginning and end of the on page script code:
This method should only be used when making the script external is impossible or impractical for some reason. It tells the validator not to consider the delimited code as XHTML.Code:<script type="text/javascript"> /* <![CDATA[ */ Your script code goes here /* ]]> */ </script>
Using escapes is never required for validation under the XHTML DOCTYPE. Escapes can be required for proper function of a script, though usually much less so than many people imagine.
They are often required in many places in HTML 4.01 for on page script code to validate, and sometimes are not enough for that purpose. The not character data delimiters don't help there. The HTML comment delimiters might, but they carry their own risks. Best to make the scripts external rather than to resort to those.
With HTML 5 you can do anything you can do with XHTML, and anything you can do with HTML 4.01, and of course more than both combined. And script code is ignored by the HTML 5 validator. So there's no problem there. But there are other validation requirements in HTML 5 that are absent in both XHTML and HTML 4.01. So sometimes you are left either choosing the best DOCTYPE to work with for validation purposes, or just not worrying about validation.
I like my code to validate, especially example and professional production code. But if there doesn't appear to be any reasonable path to validation in such circumstances, I will let it slide as long as I'm confident it won't cause a problem. When I'm helping someone else I don't worry about it unless their existing code is already 100% valid, or if validation is their goal.
Validation is pretty much best used to diagnose and avoid problems. It can be taken to extremes. But just about everyone, once they start validating their own pages, would much rather see that green bar rather than the red one.
One thing to bear in mind is that there are a number of invalid CSS errors on the validator pages. I think I even validated a few of them once and they had HTML validation errors. So that shows what they think of their own standards. They're guidelines, not the law.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
In my opinion, the W3C validation guidelines are really just reinforcements of good coding practices. If you have good coding practices (i.e. lowecase html tags, ending tags, etc.) then you can pass validation, the guidelines are really to help webpaes to become more easily understandable, as well as helping compatability, which may be effected by the forementioned examples. The W3C guidelines are there to make the web a better place, and if you simply ignore them, then your webpage can quickly detereorate into an unreadable mess.
They also help when you want to go back an edit a page later, or if suddenly you webpage has stopped woring. If you have followed the W3C guidelines, you should be able to both easily read and understand your own code, and be able to pass it through the validator and see if their are any problems with the code that may be effecting it. As per John said they are not laws and you don't have to follow them, but it well help both you and the greater web community greatly.
In summary, there is most definately a point in at least attempting to validate your pages.
@John - Some of thir pages may be invalid but that doesn't mean that you shouldn't follow them anyway, as far as I know, extraordinarily few of the W3C affliates, ie, Google, Bing, have valid webpaes, but once again, that dosn't mean that you shouldn't follow them. In this case, it may look like do what I say, not What I do, but the W3C guidelines are usefull and should be followed.
"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
Anime Views Forums
Bernie
Check your pages and investigate the errors. If you find an error that is not really a problem (a great example is something in Javascript, or something that is non-standard but intentional) then you can in almost all cases ignore it. Just do this thoughtfully and stick to standards unless you have a good reason to ignore them.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Well then the remaining concern is for those who want to use the w3c icon. It wouldn't do to include the icon on a page that doesn't validate. (Or is the icon just vanity in the first place?)
Vanity and/or insanity. It's generally not all that hard to get your page to validate, though it sometimes can be quite a chore. It often does require some general knowledge about HTML and CSS or a WYSIWYG editor that writes valid code. As far as javascript goes, that should never be a problem. Just make the script external, or use an HTML 5 DOCTYPE, or an XHTML DOCTYPE with not character data comments around the script code.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
In my experience, the valid icons are really just vanity, so the designers of the webpage going, "hey! Look at me, I can write valid code!", it is certainly likely, though not ethical, that some web designers do put valid buttons on their webpage when it isn't valid, I have come across that numerous times. Personally, I write my code to XHTML 1.0 strict standards, but I don't like to include the valid button, because often it just isn't in the feel of the webpage I'm making.
"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
Anime Views Forums
Bernie
I think there's another valid way of looking at it. w3c validation performs an often valuable service. When a web page doesn't work as intended, w3c validation can often help determine why. Use of the icon is a way of publicizing the w3c. This serves a useful educational purpose.
That may be true, however, think about how much exposure this would actually get them, if so few webpages are even valid, let alone have the button on it.
"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
Anime Views Forums
Bernie
I agree that there is some vanity and/or sense of accomplishment in validating a page. And that the icons often look out of place on a professional page. They do go well on a demo page if you're trying to emphasize that your code can be used on a valid page.
And I agree that the validation service is an invaluable tool when something is awry with your page. It won't always solve it, but it often can, especially when you've exhausted all other avenues available.
I'm not sure the w3c needs any publicity via those icons though. Perhaps. But I'm sure they realize that virtually all serious developers would never display them on commercial work.
I think they have all the notoriety they need simply by virtue of the fact that if you do any serious search on elements, syntax, objects, etc. involved in HTML, XHTML, JavaScript, XML, CSS - just to name the main ones, you are bound to run across the w3c a lot.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks