Arieh.co.il

Bye Bye Tidy. Hello W3C Bookmarklet

In the past few days, I've decided to abandon one of my favorite developmnt tools - HTML Validator (AKA tidy). If you aren't familiar with this tool, HTML Validator is a useful tool that sits on the corner of your browser and gives you feedback on wethear you page validates or not.

Moreover, it also inject itself natively into FireFox's view-source tool, giving you heighlights and improvment tips. If that's not enough, it also has the ability to cleanup your code. To wrap it up - it does this within your browser, so you can do this even when you are developing without an internet connection (which is still something that happens for me), and also for local files (which is very important).

So why the hell do I want to abandon such a magnificent tool? There are two reasons -

  1. The first is that it is always on. This means that it parses every page i open, and this has sometimes reasulted in a noticeable delay. This is something I've chosen to live with, and have for the past two years at least.
  2. The second, which eventualy broke me - is that it is outdated. It has no support for RDFa. I've tried to hack a solution for this, but sience all IE's have difficulty parsing the XML version of RDFa I've simply abandoned it. But it also lacks support for HTML5, and this is not something that I can keep living without.

So I tried to switch to another very popular validation addon - Total Validator. This one is completely dated. It also have some other very cool features, such as giving you screen shots of the page with whatever browser you would like. It's great disadvantage is that it uses an online validator, which means no local files` support. It's also quite slow.

Afer using this one for a few days, complaining to myself of how slow it is, i reminded myself that I already know a tool that does online validation, and does it well and fast - the W3C validator, and that if all Total Validator does for me is open a new tab with online validation (I have no need for browser shots), I can simply create a bookmarklet for it. So here it is:

(function(){
    var location = "http://validator.w3.org/check?uri="+encodeURIComponent(window.location);
    window.open(location);
})()

And here is a link you can bookmark. If you're not familiar with bookmarklets, simply drag the link to your bookmarks folder, than use it on any page you would like.

But what about local files? Well, for normal pages (ones that still stick to XHTML1.0) I will still use tidy. For H5 and it's friends, the best I can do is to copy the code and paste it to the W3C's validator...

JavaScript Reference, JavaScript Guide, JavaScript API, JS API, JS Guide, JS Reference, Learn JS, JS Documentation