creating new elements via jQuery(html) as <a> versus <a/>
In jQuery 1.2.6, I've noticed that this works in IE7:
$(document.body).append($("<a/>")
.attr("href", "http://www.google.com/")
.html("Click Me!"));
But that this does not:
$(document.body).append($("<a>")
.attr("href", "http://www.google.com/")
.html("Click Me!"));
The salient difference being creating the anchor element as "<a/>"
versus "<a>". This also appears to be the case with "<span/>" versus
"<span>". A bit of digging shows that the difference appears to be
whether the elements end up getting created as simply "<a>" or "<a></
a>". It looks like this is what jQuery.clean tries to take care of.
Strictly speaking, I understand that jQuery(html) probably ought to be
taking "valid HTML", which an unclosed anchor tag certainly is not.
But either syntax appears to work fine in Firefox and Safari, so it
would be awesome to have jQuery hide this difference. Or, in lieu of
that, to be a bit more specific in the documentation about what kind
of stuff is expected as "html" to the jQuery(html) function. :)
thanks!
chris