Pure JavaScript HTML Parser
12
May
John Resig (the creator of jQuery) has created a pure JavaScript HTML parser that can definitely be very handy.
As more HTML code is inserted and formatted inside JavaScript tags, this parser can save serious development time with automating the process.
Some examples:
- Unclosed Tags:
HTMLtoXML("<p><b>Hello") == '<p><b>Hello</b></p>' - Empty Elements:
HTMLtoXML("<img src=test.jpg>") == '<img src="test.jpg"/>' - Attributes Without Values:
HTMLtoXML("<input disabled>") == '<input disabled="disabled"/>'
HTML is a language with lots of tricks and the parser may fail in some cases but it will work in most of them and will become better by time for sure.
- Tags:
Html Javascript
- Filed under: Extras, Other License, Tools
Related Posts
Leave a reply
















