jQuery's .html() function is frequently used to read and modify the contents of a page, unfortunately is uses innerHTML for this. innerHTML is evil for a number of reasons; mainly it's poor support in IE and inconsistent output across browsers
To illustrate this I've compared jQuery's .html() output, and that of innerXHTML which reads and writes clean XHTML reliably.
Sure enough, we get some problems with jQuery (innerHTML) in IE:
- No "quotes" on some attributes (id and class in this example);
- UPPERCASE tags;
- Ending list item tags </li> only appear on the last list item.
So for example if you were to use .html() to check whether a node contained particular HTML it's not going to work. Or likewise, if you wanted to feed your page's HTML to, say, a Flash parser it's going to have to deal with a load of crud.
jQuery interacts beautifully with the DOM, it'd be nice if you could harness some of that power when spitting out a HTML string as with innerXHTML