Is there a pure Javascript X/HTML validator? [closed]

I want to know if there's an existing Javascript library for validating HTML, preferably not one that relies on a web API.

The closest I've found to this is John Resig's HTML parser, but that seems to be more about fixing HTML and converting it to XML.

So is there something out there already? And if not, how difficult (and lengthy) would it be to adapt John Resig's parser?



No, there isn't one. However I am writing one:


You can't validate HTML with Javascript, because Javascript is loaded from within the HTML, which means the HTML is already rendered by the browser, which means all you can see with Javascript is the dom tree. The dom tree is built by the browser, but renders with and 'fixes' invalidations.

In short: What you need to validate HTML, is the HTML source. Javascript has access to the DOM, but not to the source.

And immediately after posting, I'm thinking... You don't mean validating its own page =) You just want to validate a string with a javascript... So ignore this =)


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.