Hi,
Is it useful to have a simple toDOM(html) function in MochKit.DOM? I
like it because I can make simple templates as html snippets, which I
find more readable than the corresponding createDOM constructions.
Usage:
var html = '<div class="selection"><img src="example.png"/>My
Text</div>';
var domElements = toDOM(html);
var container= getElement('container');
for(i=0, n=domElements.length; i<n; ++i) {
container.appendChild(domElements[i]);
}
The implementation is simple (as standalone function):
function toDOM(html)
{
var div = MochiKit.DOM.DIV();
div.innerHTML = html;
return div.childNodes;
}
Does anyone know how wel-supported the non-standard innerHTML is?
Ciao, Marc.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---