jQuery.fragments and simple HTML

jQuery.fragments and simple HTML

I've been looking into jQuery.fragments and have a couple of
suggestions.
It'd be useful, I think, if jQuery.fragments could be used to store
basic DOM nodes as well, for example (currently it only stores
fragments):
jQuery.fragments['<div/>'] = document.createElement('div');
...
cachedDiv.cloneNode(false); seems to be faster than
document.createElement('div'). (I've only tested briefly in Chrome &
FF)
Anyway, currently, jQuery checks for simple HTML like "<div/>" and
will create an element on the fly, without even checking
jQuery.fragments for that element. Maybe these single DOM nodes could
also be cached in jQuery.fragments, but on their own -- not within a
fragment.
Also, checking against jQuery.fragments for simple HTML ("<div/>")
would open doors for built-in "templating" (minus the interpolation
and all that jazz). E.g.
jQuery.extend(jQuery.fragments, {
'<containerDiv/>': $('<div class="container">...</div>')[0] //
or, .parent()[0] to get at fragment...
});
... And later on:
$('<containerDiv/>') ...
Just an idea.
I really like the idea of caching HTML, but I think the current
behaviour could be extended to make it a little more useful.
--